From 3c3f6af5107b33e84122d793dd9d5b1dbd66cb86 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 4 Jul 2025 05:08:51 +0000 Subject: [PATCH] code and test --- sdk/network/azure-mgmt-dns/CHANGELOG.md | 25 + sdk/network/azure-mgmt-dns/MANIFEST.in | 1 - sdk/network/azure-mgmt-dns/README.md | 6 +- sdk/network/azure-mgmt-dns/_meta.json | 15 - sdk/network/azure-mgmt-dns/_metadata.json | 11 + .../azure-mgmt-dns/azure/mgmt/dns/__init__.py | 26 +- .../azure/mgmt/dns/_configuration.py | 59 +- .../azure/mgmt/dns/_dns_management_client.py | 230 +-- .../mgmt/dns/{v2016_04_01 => }/_patch.py | 9 +- .../_version.py => _utils/__init__.py} | 3 - .../serialization.py} | 580 +++---- .../azure-mgmt-dns/azure/mgmt/dns/_version.py | 2 +- .../azure/mgmt/dns/aio/__init__.py | 23 +- .../azure/mgmt/dns/aio/_configuration.py | 59 +- .../mgmt/dns/aio/_dns_management_client.py | 232 +-- .../aio/operations => aio}/_patch.py | 9 +- .../aio/operations/__init__.py | 16 +- .../_dns_resource_reference_operations.py | 37 +- .../models => aio/operations}/_patch.py | 9 +- .../aio/operations/_record_sets_operations.py | 117 +- .../aio/operations/_zones_operations.py | 83 +- .../azure-mgmt-dns/azure/mgmt/dns/models.py | 7 - .../azure/mgmt/dns/models/__init__.py | 76 + .../models/_dns_management_client_enums.py | 0 .../{v2018_05_01 => }/models/_models_py3.py | 125 +- .../dns/{v2016_04_01/aio => models}/_patch.py | 9 +- .../{v2018_05_01 => }/operations/__init__.py | 16 +- .../_dns_resource_reference_operations.py | 40 +- .../azure/mgmt/dns/operations/_patch.py | 21 + .../operations/_record_sets_operations.py | 133 +- .../operations/_zones_operations.py | 97 +- .../azure/mgmt/dns/v2016_04_01/__init__.py | 26 - .../mgmt/dns/v2016_04_01/_configuration.py | 65 - .../dns/v2016_04_01/_dns_management_client.py | 117 -- .../azure/mgmt/dns/v2016_04_01/_metadata.json | 111 -- .../mgmt/dns/v2016_04_01/aio/__init__.py | 23 - .../dns/v2016_04_01/aio/_configuration.py | 65 - .../v2016_04_01/aio/_dns_management_client.py | 119 -- .../v2016_04_01/aio/operations/__init__.py | 21 - .../aio/operations/_record_sets_operations.py | 768 --------- .../aio/operations/_zones_operations.py | 562 ------- .../mgmt/dns/v2016_04_01/models/__init__.py | 63 - .../models/_dns_management_client_enums.py | 92 -- .../dns/v2016_04_01/models/_models_py3.py | 807 ---------- .../dns/v2016_04_01/operations/__init__.py | 21 - .../mgmt/dns/v2016_04_01/operations/_patch.py | 20 - .../operations/_record_sets_operations.py | 1040 ------------- .../operations/_zones_operations.py | 730 --------- .../azure/mgmt/dns/v2016_04_01/py.typed | 1 - .../mgmt/dns/v2018_03_01_preview/__init__.py | 26 - .../dns/v2018_03_01_preview/_configuration.py | 65 - .../_dns_management_client.py | 119 -- .../dns/v2018_03_01_preview/_metadata.json | 111 -- .../mgmt/dns/v2018_03_01_preview/_patch.py | 20 - .../mgmt/dns/v2018_03_01_preview/_version.py | 9 - .../dns/v2018_03_01_preview/aio/__init__.py | 23 - .../v2018_03_01_preview/aio/_configuration.py | 65 - .../aio/_dns_management_client.py | 121 -- .../dns/v2018_03_01_preview/aio/_patch.py | 20 - .../aio/operations/__init__.py | 21 - .../aio/operations/_patch.py | 20 - .../aio/operations/_record_sets_operations.py | 883 ----------- .../aio/operations/_zones_operations.py | 720 --------- .../v2018_03_01_preview/models/__init__.py | 61 - .../v2018_03_01_preview/models/_models_py3.py | 816 ---------- .../dns/v2018_03_01_preview/models/_patch.py | 20 - .../operations/__init__.py | 21 - .../v2018_03_01_preview/operations/_patch.py | 20 - .../operations/_record_sets_operations.py | 1194 -------------- .../operations/_zones_operations.py | 923 ----------- .../mgmt/dns/v2018_03_01_preview/py.typed | 1 - .../azure/mgmt/dns/v2018_05_01/__init__.py | 26 - .../mgmt/dns/v2018_05_01/_configuration.py | 66 - .../dns/v2018_05_01/_dns_management_client.py | 124 -- .../azure/mgmt/dns/v2018_05_01/_metadata.json | 112 -- .../azure/mgmt/dns/v2018_05_01/_patch.py | 20 - .../azure/mgmt/dns/v2018_05_01/_version.py | 9 - .../mgmt/dns/v2018_05_01/aio/__init__.py | 23 - .../dns/v2018_05_01/aio/_configuration.py | 66 - .../v2018_05_01/aio/_dns_management_client.py | 126 -- .../azure/mgmt/dns/v2018_05_01/aio/_patch.py | 20 - .../dns/v2018_05_01/aio/operations/_patch.py | 20 - .../mgmt/dns/v2018_05_01/models/__init__.py | 65 - .../models/_dns_management_client_enums.py | 32 - .../mgmt/dns/v2018_05_01/models/_patch.py | 20 - .../mgmt/dns/v2018_05_01/operations/_patch.py | 20 - .../azure/mgmt/dns/v2018_05_01/py.typed | 1 - .../mgmt/dns/v2023_07_01_preview/__init__.py | 26 - .../dns/v2023_07_01_preview/_configuration.py | 65 - .../_dns_management_client.py | 130 -- .../dns/v2023_07_01_preview/_metadata.json | 113 -- .../mgmt/dns/v2023_07_01_preview/_patch.py | 20 - .../mgmt/dns/v2023_07_01_preview/_version.py | 9 - .../dns/v2023_07_01_preview/aio/__init__.py | 23 - .../v2023_07_01_preview/aio/_configuration.py | 65 - .../aio/_dns_management_client.py | 133 -- .../dns/v2023_07_01_preview/aio/_patch.py | 20 - .../aio/operations/__init__.py | 25 - .../_dns_resource_reference_operations.py | 156 -- .../operations/_dnssec_configs_operations.py | 466 ------ .../aio/operations/_patch.py | 20 - .../aio/operations/_record_sets_operations.py | 883 ----------- .../aio/operations/_zones_operations.py | 724 --------- .../v2023_07_01_preview/models/__init__.py | 85 - .../models/_dns_management_client_enums.py | 44 - .../v2023_07_01_preview/models/_models_py3.py | 1372 ----------------- .../dns/v2023_07_01_preview/models/_patch.py | 20 - .../operations/__init__.py | 25 - .../_dns_resource_reference_operations.py | 188 --- .../operations/_dnssec_configs_operations.py | 603 -------- .../v2023_07_01_preview/operations/_patch.py | 20 - .../operations/_record_sets_operations.py | 1194 -------------- .../operations/_zones_operations.py | 927 ----------- .../mgmt/dns/v2023_07_01_preview/py.typed | 1 - .../create_or_update_aaaa_recordset.py | 1 + .../create_or_update_arecordset.py | 1 + .../create_or_update_arecordset_alias.py | 1 + .../create_or_update_caa_recordset.py | 1 + .../create_or_update_cname_recordset.py | 1 + .../create_or_update_mx_recordset.py | 1 + .../create_or_update_ns_recordset.py | 1 + .../create_or_update_ptr_recordset.py | 1 + .../create_or_update_soa_recordset.py | 1 + .../create_or_update_srv_recordset.py | 1 + .../create_or_update_txt_recordset.py | 1 + .../create_or_update_zone.py | 1 + .../delete_aaaa_recordset.py | 1 + .../generated_samples/delete_arecordset.py | 1 + .../generated_samples/delete_caa_recordset.py | 1 + .../generated_samples/delete_ptr_recordset.py | 1 + .../generated_samples/delete_srv_recordset.py | 1 + .../generated_samples/delete_txt_recordset.py | 1 + .../generated_samples/get_aaaa_recordset.py | 1 + .../generated_samples/get_caa_recordset.py | 1 + .../generated_samples/get_cname_recordset.py | 1 + .../get_dns_resource_reference.py | 1 + .../generated_samples/get_mx_recordset.py | 1 + .../generated_samples/get_ns_recordset.py | 1 + .../generated_samples/get_ptr_recordset.py | 1 + .../generated_samples/get_soa_recordset.py | 1 + .../generated_samples/get_srv_recordset.py | 1 + .../generated_samples/get_txt_recordset.py | 1 + .../generated_samples/list_aaaa_recordset.py | 1 + .../generated_samples/list_arecordset.py | 1 + .../generated_samples/list_caa_recordset.py | 1 + .../generated_samples/list_cname_recordset.py | 1 + .../generated_samples/list_mx_recordset.py | 1 + .../generated_samples/list_ns_recordset.py | 1 + .../generated_samples/list_ptr_recordset.py | 1 + .../list_record_sets_by_zone.py | 3 +- .../generated_samples/list_soa_recordset.py | 1 + .../generated_samples/list_srv_recordset.py | 1 + .../generated_samples/list_txt_recordset.py | 1 + .../list_zones_by_resource_group.py | 1 + .../list_zones_by_subscription.py | 1 + .../generated_samples/patch_aaaa_recordset.py | 1 + .../generated_samples/patch_arecordset.py | 1 + .../generated_samples/patch_caa_recordset.py | 1 + .../patch_cname_recordset.py | 1 + .../generated_samples/patch_mx_recordset.py | 1 + .../generated_samples/patch_ns_recordset.py | 1 + .../generated_samples/patch_ptr_recordset.py | 1 + .../generated_samples/patch_soa_recordset.py | 1 + .../generated_samples/patch_srv_recordset.py | 1 + .../generated_samples/patch_txt_recordset.py | 1 + .../generated_tests/conftest.py | 2 +- ...ement_dns_resource_reference_operations.py | 2 +- ...dns_resource_reference_operations_async.py | 2 +- ...t_dns_management_record_sets_operations.py | 14 +- ...management_record_sets_operations_async.py | 14 +- .../test_dns_management_zones_operations.py | 12 +- ...t_dns_management_zones_operations_async.py | 12 +- sdk/network/azure-mgmt-dns/setup.py | 5 +- 173 files changed, 1111 insertions(+), 19118 deletions(-) delete mode 100644 sdk/network/azure-mgmt-dns/_meta.json create mode 100644 sdk/network/azure-mgmt-dns/_metadata.json rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2016_04_01 => }/_patch.py (61%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2016_04_01/_version.py => _utils/__init__.py} (93%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{_serialization.py => _utils/serialization.py} (82%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2016_04_01/aio/operations => aio}/_patch.py (61%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2018_05_01 => }/aio/operations/__init__.py (63%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2018_05_01 => }/aio/operations/_dns_resource_reference_operations.py (80%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2016_04_01/models => aio/operations}/_patch.py (61%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2018_05_01 => }/aio/operations/_record_sets_operations.py (89%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2018_05_01 => }/aio/operations/_zones_operations.py (91%) delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/models.py create mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/__init__.py rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2018_03_01_preview => }/models/_dns_management_client_enums.py (100%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2018_05_01 => }/models/_models_py3.py (87%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2016_04_01/aio => models}/_patch.py (61%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2018_05_01 => }/operations/__init__.py (63%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2018_05_01 => }/operations/_dns_resource_reference_operations.py (82%) create mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_patch.py rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2018_05_01 => }/operations/_record_sets_operations.py (91%) rename sdk/network/azure-mgmt-dns/azure/mgmt/dns/{v2018_05_01 => }/operations/_zones_operations.py (92%) delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_configuration.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_dns_management_client.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_metadata.json delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_configuration.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_dns_management_client.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_record_sets_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_zones_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_dns_management_client_enums.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_models_py3.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_record_sets_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_zones_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/py.typed delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_configuration.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_dns_management_client.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_metadata.json delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_version.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_configuration.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_dns_management_client.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_record_sets_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_zones_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/_models_py3.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_record_sets_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_zones_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/py.typed delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_configuration.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_dns_management_client.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_metadata.json delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_version.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_configuration.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_dns_management_client.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_dns_management_client_enums.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/py.typed delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_configuration.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_dns_management_client.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_metadata.json delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_version.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_configuration.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_dns_management_client.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_dns_resource_reference_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_dnssec_configs_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_record_sets_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_zones_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_dns_management_client_enums.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_models_py3.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/__init__.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_dns_resource_reference_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_dnssec_configs_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_patch.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_record_sets_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_zones_operations.py delete mode 100644 sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/py.typed diff --git a/sdk/network/azure-mgmt-dns/CHANGELOG.md b/sdk/network/azure-mgmt-dns/CHANGELOG.md index b8f29a8324cd..0347992d4f1a 100644 --- a/sdk/network/azure-mgmt-dns/CHANGELOG.md +++ b/sdk/network/azure-mgmt-dns/CHANGELOG.md @@ -1,5 +1,30 @@ # Release History +## 9.0.0 (2025-07-20) + +### Breaking Changes + + - Deleted or renamed client operation group `DnsManagementClient.dnssec_configs` + - Model `RecordSet` deleted or renamed its instance variable `traffic_management_profile` + - Model `RecordSet` deleted or renamed its instance variable `ds_records` + - Model `RecordSet` deleted or renamed its instance variable `tlsa_records` + - Model `RecordSet` deleted or renamed its instance variable `naptr_records` + - Deleted or renamed enum value `RecordType.DS` + - Deleted or renamed enum value `RecordType.NAPTR` + - Deleted or renamed enum value `RecordType.TLSA` + - Model `Zone` deleted or renamed its instance variable `system_data` + - Model `Zone` deleted or renamed its instance variable `signing_keys` + - Deleted or renamed model `CreatedByType` + - Deleted or renamed model `DelegationSignerInfo` + - Deleted or renamed model `Digest` + - Deleted or renamed model `DnssecConfig` + - Deleted or renamed model `DsRecord` + - Deleted or renamed model `NaptrRecord` + - Deleted or renamed model `SigningKey` + - Deleted or renamed model `SystemData` + - Deleted or renamed model `TlsaRecord` + - Deleted or renamed model `DnssecConfigsOperations` + ## 8.2.0 (2024-10-22) ### Features Added diff --git a/sdk/network/azure-mgmt-dns/MANIFEST.in b/sdk/network/azure-mgmt-dns/MANIFEST.in index 2404e266df68..e40cb0b059e8 100644 --- a/sdk/network/azure-mgmt-dns/MANIFEST.in +++ b/sdk/network/azure-mgmt-dns/MANIFEST.in @@ -1,4 +1,3 @@ -include _meta.json recursive-include tests *.py *.json recursive-include samples *.py *.md include *.md diff --git a/sdk/network/azure-mgmt-dns/README.md b/sdk/network/azure-mgmt-dns/README.md index bc4308b6b139..ab6741780a7d 100644 --- a/sdk/network/azure-mgmt-dns/README.md +++ b/sdk/network/azure-mgmt-dns/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure DNS Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/network/azure-mgmt-dns/_meta.json b/sdk/network/azure-mgmt-dns/_meta.json deleted file mode 100644 index 6a46a71ec1c6..000000000000 --- a/sdk/network/azure-mgmt-dns/_meta.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "commit": "7189fb57f69468c56df76f9a4d68dd9ff04ab100", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.19.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/dns/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/dns/resource-manager/readme.md", - "package-2023-07-preview": "2024-01-03 09:33:30 -0800 389c6c7476ec7c6585b002b44a9dacfb5c88b71a Microsoft.Network/preview/2023-07-01-preview/dns.json", - "package-2018-05": "2020-11-17 18:50:08 -0800 b47a32169e59378d8005aabb5358e3f4ddf10766 Microsoft.Network/stable/2018-05-01/dns.json", - "package-2018-03-preview": "2020-11-17 18:50:08 -0800 b47a32169e59378d8005aabb5358e3f4ddf10766 Microsoft.Network/preview/2018-03-01-preview/dns.json", - "package-2016-04": "2021-01-26 16:35:03 -0800 866a7d07ee081198c77bf4949e2a6ce366e103fa Microsoft.Network/stable/2016-04-01/dns.json" -} \ No newline at end of file diff --git a/sdk/network/azure-mgmt-dns/_metadata.json b/sdk/network/azure-mgmt-dns/_metadata.json new file mode 100644 index 000000000000..1c9aac835e12 --- /dev/null +++ b/sdk/network/azure-mgmt-dns/_metadata.json @@ -0,0 +1,11 @@ +{ + "commit": "2fa83723a6cb55fd7674db770351a270bd1a5e3d", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.10.2", + "use": [ + "@autorest/python@6.35.0", + "@autorest/modelerfour@4.27.0" + ], + "autorest_command": "autorest specification/dns/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-2018-05 --use=@autorest/python@6.35.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "readme": "specification/dns/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/__init__.py index d6386eaf6897..b2554cd250a4 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/__init__.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/__init__.py @@ -5,16 +5,28 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._dns_management_client import DnsManagementClient -__all__ = ['DnsManagementClient'] +from typing import TYPE_CHECKING -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import +from ._dns_management_client import DnsManagementClient # type: ignore from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DnsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_configuration.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_configuration.py index 3da2405a3de6..20626e869d87 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_configuration.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_configuration.py @@ -1,13 +1,11 @@ # coding=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 Any, TYPE_CHECKING from azure.core.pipeline import policies @@ -16,10 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class DnsManagementClientConfiguration: + +class DnsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for DnsManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +25,17 @@ class DnsManagementClientConfiguration: :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. Required. + :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the + Microsoft Azure subscription. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ): + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2018-05-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -44,23 +43,23 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-dns/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-dns/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ): - 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') + 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_dns_management_client.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_dns_management_client.py index 514818e49578..37b8176c2b67 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_dns_management_client.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_dns_management_client.py @@ -1,82 +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. -# +# Licensed under the MIT License. See License.txt in the project root for 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 Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.profiles import KnownProfiles, ProfileDefinition -from azure.profiles.multiapiclient import MultiApiClientMixin +from azure.mgmt.core.tools import get_arm_endpoints +from . import models as _models from ._configuration import DnsManagementClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer +from .operations import DnsResourceReferenceOperations, RecordSetsOperations, ZonesOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -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 DnsManagementClient(MultiApiClientMixin, _SDKClient): +class DnsManagementClient: """The DNS 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. - + :ivar record_sets: RecordSetsOperations operations + :vartype record_sets: azure.mgmt.dns.operations.RecordSetsOperations + :ivar zones: ZonesOperations operations + :vartype zones: azure.mgmt.dns.operations.ZonesOperations + :ivar dns_resource_reference: DnsResourceReferenceOperations operations + :vartype dns_resource_reference: azure.mgmt.dns.operations.DnsResourceReferenceOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. Required. + :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the + Microsoft Azure subscription. Required. :type subscription_id: str - :param api_version: API version to use if no profile is provided, or if missing in profile. - :type api_version: str - :param base_url: Service URL + :param base_url: Service URL. Default value is None. :type base_url: str - :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. + :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ - DEFAULT_API_VERSION = '2018-05-01' - _PROFILE_TAG = "azure.mgmt.dns.DnsManagementClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", - profile: KnownProfiles=KnownProfiles.default, - **kwargs: Any - ): - if api_version: - kwargs.setdefault('api_version', api_version) - self._config = DnsManagementClientConfiguration(credential, subscription_id, **kwargs) + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DnsManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,120 +79,46 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - super(DnsManagementClient, self).__init__( - api_version=api_version, - profile=profile + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.record_sets = RecordSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.zones = ZonesOperations(self._client, self._config, self._serialize, self._deserialize) + self.dns_resource_reference = DnsResourceReferenceOperations( + self._client, self._config, self._serialize, self._deserialize ) - @classmethod - def _models_dict(cls, api_version): - return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. - @classmethod - def models(cls, api_version=DEFAULT_API_VERSION): - """Module depends on the API version: + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + - * 2016-04-01: :mod:`v2016_04_01.models` - * 2018-03-01-preview: :mod:`v2018_03_01_preview.models` - * 2018-05-01: :mod:`v2018_05_01.models` - * 2023-07-01-preview: :mod:`v2023_07_01_preview.models` - """ - if api_version == '2016-04-01': - from .v2016_04_01 import models - return models - elif api_version == '2018-03-01-preview': - from .v2018_03_01_preview import models - return models - elif api_version == '2018-05-01': - from .v2018_05_01 import models - return models - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview import models - return models - raise ValueError("API version {} is not available".format(api_version)) - - @property - def dns_resource_reference(self): - """Instance depends on the API version: - - * 2018-05-01: :class:`DnsResourceReferenceOperations` - * 2023-07-01-preview: :class:`DnsResourceReferenceOperations` - """ - api_version = self._get_api_version('dns_resource_reference') - if api_version == '2018-05-01': - from .v2018_05_01.operations import DnsResourceReferenceOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import DnsResourceReferenceOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'dns_resource_reference'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def dnssec_configs(self): - """Instance depends on the API version: - - * 2023-07-01-preview: :class:`DnssecConfigsOperations` - """ - api_version = self._get_api_version('dnssec_configs') - if api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import DnssecConfigsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'dnssec_configs'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def record_sets(self): - """Instance depends on the API version: - - * 2016-04-01: :class:`RecordSetsOperations` - * 2018-03-01-preview: :class:`RecordSetsOperations` - * 2018-05-01: :class:`RecordSetsOperations` - * 2023-07-01-preview: :class:`RecordSetsOperations` - """ - api_version = self._get_api_version('record_sets') - if api_version == '2016-04-01': - from .v2016_04_01.operations import RecordSetsOperations as OperationClass - elif api_version == '2018-03-01-preview': - from .v2018_03_01_preview.operations import RecordSetsOperations as OperationClass - elif api_version == '2018-05-01': - from .v2018_05_01.operations import RecordSetsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import RecordSetsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'record_sets'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def zones(self): - """Instance depends on the API version: - - * 2016-04-01: :class:`ZonesOperations` - * 2018-03-01-preview: :class:`ZonesOperations` - * 2018-05-01: :class:`ZonesOperations` - * 2023-07-01-preview: :class:`ZonesOperations` + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse """ - api_version = self._get_api_version('zones') - if api_version == '2016-04-01': - from .v2016_04_01.operations import ZonesOperations as OperationClass - elif api_version == '2018-03-01-preview': - from .v2018_03_01_preview.operations import ZonesOperations as OperationClass - elif api_version == '2018-05-01': - from .v2018_05_01.operations import ZonesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from .v2023_07_01_preview.operations import ZonesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'zones'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - def close(self): + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: self._client.close() - def __enter__(self): + + def __enter__(self) -> Self: self._client.__enter__() return self - def __exit__(self, *exc_details): + + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_patch.py similarity index 61% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_patch.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_patch.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_version.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_utils/__init__.py similarity index 93% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_version.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/_utils/__init__.py index d5f3055d6eb4..0af9b28f6607 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_version.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_utils/__init__.py @@ -1,9 +1,6 @@ -# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for 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 = "8.2.0" diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_serialization.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_utils/serialization.py similarity index 82% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/_serialization.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/_utils/serialization.py index 59f1fcf71bc9..f5187701d7be 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_serialization.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -48,11 +30,8 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, - Mapping, ) try: @@ -62,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +70,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +93,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +136,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -179,80 +165,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -300,13 +244,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +280,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,14 +304,14 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[ - [str, Dict[str, Any], Any], Any - ] = attribute_transformer, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -382,12 +340,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -397,30 +358,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -428,9 +390,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -450,21 +414,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -503,11 +471,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -542,7 +512,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -562,13 +532,16 @@ def __init__(self, classes: Optional[Mapping[str, type]]=None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -594,12 +567,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -635,7 +610,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -666,17 +642,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -705,7 +681,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -714,11 +690,13 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -730,27 +708,26 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - do_quote = not kwargs.get('skip_quote', False) + do_quote = not kwargs.get("skip_quote", False) return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization @@ -761,19 +738,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -782,21 +760,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -807,7 +784,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -823,11 +800,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -843,23 +819,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -873,8 +852,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -884,15 +862,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -909,12 +885,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): raise serialized.append(None) - if kwargs.get('do_quote', False): - serialized = [ - '' if s is None else quote(str(s), safe='') - for s - in serialized - ] + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] if div: serialized = ["" if s is None else str(s) for s in serialized] @@ -951,9 +923,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -977,7 +948,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -985,6 +956,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1009,7 +981,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1040,56 +1012,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1097,11 +1074,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1111,30 +1089,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1147,12 +1127,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1178,13 +1159,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1192,11 +1174,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1217,7 +1199,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1238,17 +1222,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1285,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1337,22 +1333,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1360,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1369,9 +1364,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1407,27 +1402,29 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1446,13 +1443,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1482,9 +1479,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1511,6 +1507,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1522,7 +1520,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1537,10 +1535,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1558,10 +1558,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1585,24 +1587,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1611,15 +1624,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1633,7 +1647,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1653,14 +1671,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1677,6 +1695,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1687,13 +1706,14 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1726,11 +1746,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1738,8 +1757,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1749,24 +1769,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1774,6 +1793,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1787,8 +1807,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1800,6 +1819,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1810,9 +1830,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1828,8 +1848,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1840,8 +1861,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1855,8 +1877,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1871,8 +1894,9 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1883,8 +1907,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1893,16 +1918,16 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1916,8 +1941,9 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1930,31 +1956,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1982,8 +2009,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1991,8 +2017,9 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore @@ -2002,5 +2029,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_version.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_version.py index 2fb918ea8c81..14d0091047ac 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_version.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "8.2.0" +VERSION = "9.0.0" diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/__init__.py index 1a93fabcef86..c3dc445bd63f 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/__init__.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/__init__.py @@ -5,6 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._dns_management_client import DnsManagementClient -__all__ = ['DnsManagementClient'] +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._dns_management_client import DnsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "DnsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_configuration.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_configuration.py index 2621a2f2502d..a5ad3b543fb9 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_configuration.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_configuration.py @@ -1,13 +1,11 @@ # coding=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 Any, TYPE_CHECKING from azure.core.pipeline import policies @@ -16,10 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class DnsManagementClientConfiguration: + +class DnsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for DnsManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,16 +25,17 @@ class DnsManagementClientConfiguration: :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. Required. + :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the + Microsoft Azure subscription. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2018-05-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -44,23 +43,23 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-dns/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-dns/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) 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') + 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_dns_management_client.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_dns_management_client.py index 7925c2f0bea8..3c6db25a6d46 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_dns_management_client.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_dns_management_client.py @@ -1,82 +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. -# +# Licensed under the MIT License. See License.txt in the project root for 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 Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.profiles import KnownProfiles, ProfileDefinition -from azure.profiles.multiapiclient import MultiApiClientMixin +from azure.mgmt.core.tools import get_arm_endpoints -from .._serialization import Deserializer, Serializer +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer from ._configuration import DnsManagementClientConfiguration +from .operations import DnsResourceReferenceOperations, RecordSetsOperations, ZonesOperations if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -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 DnsManagementClient(MultiApiClientMixin, _SDKClient): +class DnsManagementClient: """The DNS 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. - + :ivar record_sets: RecordSetsOperations operations + :vartype record_sets: azure.mgmt.dns.aio.operations.RecordSetsOperations + :ivar zones: ZonesOperations operations + :vartype zones: azure.mgmt.dns.aio.operations.ZonesOperations + :ivar dns_resource_reference: DnsResourceReferenceOperations operations + :vartype dns_resource_reference: azure.mgmt.dns.aio.operations.DnsResourceReferenceOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. Required. + :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the + Microsoft Azure subscription. Required. :type subscription_id: str - :param api_version: API version to use if no profile is provided, or if missing in profile. - :type api_version: str - :param base_url: Service URL + :param base_url: Service URL. Default value is None. :type base_url: str - :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. + :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ - DEFAULT_API_VERSION = '2018-05-01' - _PROFILE_TAG = "azure.mgmt.dns.DnsManagementClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", - profile: KnownProfiles = KnownProfiles.default, - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - if api_version: - kwargs.setdefault('api_version', api_version) - self._config = DnsManagementClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DnsManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,120 +79,50 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - super(DnsManagementClient, self).__init__( - api_version=api_version, - profile=profile + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs ) - @classmethod - def _models_dict(cls, api_version): - return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.record_sets = RecordSetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.zones = ZonesOperations(self._client, self._config, self._serialize, self._deserialize) + self.dns_resource_reference = DnsResourceReferenceOperations( + self._client, self._config, self._serialize, self._deserialize + ) - @classmethod - def models(cls, api_version=DEFAULT_API_VERSION): - """Module depends on the API version: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. - * 2016-04-01: :mod:`v2016_04_01.models` - * 2018-03-01-preview: :mod:`v2018_03_01_preview.models` - * 2018-05-01: :mod:`v2018_05_01.models` - * 2023-07-01-preview: :mod:`v2023_07_01_preview.models` - """ - if api_version == '2016-04-01': - from ..v2016_04_01 import models - return models - elif api_version == '2018-03-01-preview': - from ..v2018_03_01_preview import models - return models - elif api_version == '2018-05-01': - from ..v2018_05_01 import models - return models - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview import models - return models - raise ValueError("API version {} is not available".format(api_version)) - - @property - def dns_resource_reference(self): - """Instance depends on the API version: - - * 2018-05-01: :class:`DnsResourceReferenceOperations` - * 2023-07-01-preview: :class:`DnsResourceReferenceOperations` - """ - api_version = self._get_api_version('dns_resource_reference') - if api_version == '2018-05-01': - from ..v2018_05_01.aio.operations import DnsResourceReferenceOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import DnsResourceReferenceOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'dns_resource_reference'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def dnssec_configs(self): - """Instance depends on the API version: - - * 2023-07-01-preview: :class:`DnssecConfigsOperations` - """ - api_version = self._get_api_version('dnssec_configs') - if api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import DnssecConfigsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'dnssec_configs'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def record_sets(self): - """Instance depends on the API version: - - * 2016-04-01: :class:`RecordSetsOperations` - * 2018-03-01-preview: :class:`RecordSetsOperations` - * 2018-05-01: :class:`RecordSetsOperations` - * 2023-07-01-preview: :class:`RecordSetsOperations` - """ - api_version = self._get_api_version('record_sets') - if api_version == '2016-04-01': - from ..v2016_04_01.aio.operations import RecordSetsOperations as OperationClass - elif api_version == '2018-03-01-preview': - from ..v2018_03_01_preview.aio.operations import RecordSetsOperations as OperationClass - elif api_version == '2018-05-01': - from ..v2018_05_01.aio.operations import RecordSetsOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import RecordSetsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'record_sets'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def zones(self): - """Instance depends on the API version: - - * 2016-04-01: :class:`ZonesOperations` - * 2018-03-01-preview: :class:`ZonesOperations` - * 2018-05-01: :class:`ZonesOperations` - * 2023-07-01-preview: :class:`ZonesOperations` + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse """ - api_version = self._get_api_version('zones') - if api_version == '2016-04-01': - from ..v2016_04_01.aio.operations import ZonesOperations as OperationClass - elif api_version == '2018-03-01-preview': - from ..v2018_03_01_preview.aio.operations import ZonesOperations as OperationClass - elif api_version == '2018-05-01': - from ..v2018_05_01.aio.operations import ZonesOperations as OperationClass - elif api_version == '2023-07-01-preview': - from ..v2023_07_01_preview.aio.operations import ZonesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'zones'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - async def close(self): + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: await self._client.close() - async def __aenter__(self): + + async def __aenter__(self) -> Self: await self._client.__aenter__() return self - async def __aexit__(self, *exc_details): + + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_patch.py similarity index 61% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_patch.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_patch.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/__init__.py similarity index 63% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/__init__.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/__init__.py index bb9e9fe8e4bb..4fe60e6266e3 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/__init__.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/__init__.py @@ -5,13 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._record_sets_operations import RecordSetsOperations -from ._zones_operations import ZonesOperations -from ._dns_resource_reference_operations import DnsResourceReferenceOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._record_sets_operations import RecordSetsOperations # type: ignore +from ._zones_operations import ZonesOperations # type: ignore +from ._dns_resource_reference_operations import DnsResourceReferenceOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -19,5 +25,5 @@ "ZonesOperations", "DnsResourceReferenceOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_dns_resource_reference_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_dns_resource_reference_operations.py similarity index 80% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_dns_resource_reference_operations.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_dns_resource_reference_operations.py index 22e1cf3911c0..9feb504a8fe4 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_dns_resource_reference_operations.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_dns_resource_reference_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +25,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._dns_resource_reference_operations import build_get_by_target_resources_request +from .._configuration import DnsManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +39,7 @@ class DnsResourceReferenceOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2018_05_01.aio.DnsManagementClient`'s + :class:`~azure.mgmt.dns.aio.DnsManagementClient`'s :attr:`dns_resource_reference` attribute. """ @@ -49,11 +47,10 @@ class DnsResourceReferenceOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DnsManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def get_by_target_resources( @@ -62,12 +59,12 @@ async def get_by_target_resources( """Returns the DNS records specified by the referencing targetResourceIds. :param parameters: Properties for dns resource reference request. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.DnsResourceReferenceRequest + :type parameters: ~azure.mgmt.dns.models.DnsResourceReferenceRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.DnsResourceReferenceResult + :rtype: ~azure.mgmt.dns.models.DnsResourceReferenceResult :raises ~azure.core.exceptions.HttpResponseError: """ @@ -83,7 +80,7 @@ async def get_by_target_resources( Default value is "application/json". :paramtype content_type: str :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.DnsResourceReferenceResult + :rtype: ~azure.mgmt.dns.models.DnsResourceReferenceResult :raises ~azure.core.exceptions.HttpResponseError: """ @@ -95,12 +92,12 @@ async def get_by_target_resources( :param parameters: Properties for dns resource reference request. Is either a DnsResourceReferenceRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.DnsResourceReferenceRequest or IO[bytes] + :type parameters: ~azure.mgmt.dns.models.DnsResourceReferenceRequest or IO[bytes] :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.DnsResourceReferenceResult + :rtype: ~azure.mgmt.dns.models.DnsResourceReferenceResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +108,7 @@ async def get_by_target_resources( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DnsResourceReferenceResult] = kwargs.pop("cls", None) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_patch.py similarity index 61% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_patch.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_patch.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_record_sets_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_record_sets_operations.py similarity index 89% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_record_sets_operations.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_record_sets_operations.py index 56234dc34b47..c6633b5f0f37 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_record_sets_operations.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_record_sets_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +28,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._record_sets_operations import ( build_create_or_update_request, build_delete_request, @@ -37,11 +38,8 @@ build_list_by_type_request, build_update_request, ) +from .._configuration import DnsManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +50,7 @@ class RecordSetsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2018_05_01.aio.DnsManagementClient`'s + :class:`~azure.mgmt.dns.aio.DnsManagementClient`'s :attr:`record_sets` attribute. """ @@ -60,11 +58,10 @@ class RecordSetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DnsManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def update( @@ -90,9 +87,9 @@ async def update( :type relative_record_set_name: str :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :type parameters: ~azure.mgmt.dns.models.RecordSet :param if_match: The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent changes. Default value is None. @@ -101,7 +98,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -129,7 +126,7 @@ async def update( :type relative_record_set_name: str :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the Update operation. Required. :type parameters: IO[bytes] :param if_match: The etag of the record set. Omit this value to always overwrite the current @@ -140,7 +137,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -166,19 +163,19 @@ async def update( :type relative_record_set_name: str :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the Update operation. Is either a RecordSet type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.RecordSet or IO[bytes] + :type parameters: ~azure.mgmt.dns.models.RecordSet or IO[bytes] :param if_match: The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent changes. Default value is None. :type if_match: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,7 +186,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) @@ -261,9 +258,9 @@ async def create_or_update( :param record_type: The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :type parameters: ~azure.mgmt.dns.models.RecordSet :param if_match: The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. @@ -275,7 +272,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -305,7 +302,7 @@ async def create_or_update( :param record_type: The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. :type parameters: IO[bytes] :param if_match: The etag of the record set. Omit this value to always overwrite the current @@ -319,7 +316,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -347,10 +344,10 @@ async def create_or_update( :param record_type: The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a RecordSet type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.RecordSet or IO[bytes] + :type parameters: ~azure.mgmt.dns.models.RecordSet or IO[bytes] :param if_match: The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. @@ -359,10 +356,10 @@ async def create_or_update( updating an existing record set. Other values will be ignored. Default value is None. :type if_none_match: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +370,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) @@ -421,7 +418,7 @@ async def create_or_update( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, zone_name: str, @@ -442,7 +439,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :param record_type: The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param if_match: The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. Default value is None. @@ -451,7 +448,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -462,7 +459,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -512,12 +509,12 @@ async def get( :type relative_record_set_name: str :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -528,7 +525,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) _request = build_get_request( @@ -570,7 +567,7 @@ def list_by_type( top: Optional[int] = None, recordsetnamesuffix: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: + ) -> AsyncItemPaged["_models.RecordSet"]: """Lists the record sets of a specified type in a DNS zone. :param resource_group_name: The name of the resource group. Required. @@ -579,25 +576,25 @@ def list_by_type( :type zone_name: str :param record_type: The type of record sets to enumerate. Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param top: The maximum number of record sets to return. If not specified, returns up to 100 record sets. Default value is None. :type top: int :param recordsetnamesuffix: The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. + only records that end with .\\ :code:``. Default value is None. :type recordsetnamesuffix: str :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2018_05_01.models.RecordSet] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.models.RecordSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +627,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -670,7 +667,7 @@ def list_by_dns_zone( top: Optional[int] = None, recordsetnamesuffix: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: + ) -> AsyncItemPaged["_models.RecordSet"]: """Lists all record sets in a DNS zone. :param resource_group_name: The name of the resource group. Required. @@ -682,19 +679,19 @@ def list_by_dns_zone( :type top: int :param recordsetnamesuffix: The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. + only records that end with .\\ :code:``. Default value is None. :type recordsetnamesuffix: str :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2018_05_01.models.RecordSet] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.models.RecordSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -726,7 +723,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -766,7 +763,7 @@ def list_all_by_dns_zone( top: Optional[int] = None, record_set_name_suffix: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: + ) -> AsyncItemPaged["_models.RecordSet"]: """Lists all record sets in a DNS zone. :param resource_group_name: The name of the resource group. Required. @@ -778,19 +775,19 @@ def list_all_by_dns_zone( :type top: int :param record_set_name_suffix: The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. + only records that end with .\\ :code:``. Default value is None. :type record_set_name_suffix: str :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2018_05_01.models.RecordSet] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.models.RecordSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -822,7 +819,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_zones_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_zones_operations.py similarity index 91% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_zones_operations.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_zones_operations.py index b8e2dc8523e4..2688b1c0eea6 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_zones_operations.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/aio/operations/_zones_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._zones_operations import ( build_create_or_update_request, build_delete_request, @@ -40,11 +41,8 @@ build_list_request, build_update_request, ) +from .._configuration import DnsManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +53,7 @@ class ZonesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2018_05_01.aio.DnsManagementClient`'s + :class:`~azure.mgmt.dns.aio.DnsManagementClient`'s :attr:`zones` attribute. """ @@ -63,11 +61,10 @@ class ZonesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DnsManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def create_or_update( @@ -88,7 +85,7 @@ async def create_or_update( :param zone_name: The name of the DNS zone (without a terminating dot). Required. :type zone_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.Zone + :type parameters: ~azure.mgmt.dns.models.Zone :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. @@ -100,7 +97,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ @@ -135,7 +132,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ @@ -157,7 +154,7 @@ async def create_or_update( :type zone_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a Zone type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.Zone or IO[bytes] + :type parameters: ~azure.mgmt.dns.models.Zone or IO[bytes] :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. @@ -166,10 +163,10 @@ async def create_or_update( an existing zone. Other values will be ignored. Default value is None. :type if_none_match: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +177,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Zone] = kwargs.pop("cls", None) @@ -228,7 +225,7 @@ async def create_or_update( async def _delete_initial( self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +236,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -298,7 +295,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -345,10 +342,10 @@ async def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> :param zone_name: The name of the DNS zone (without a terminating dot). Required. :type zone_name: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,7 +356,7 @@ async def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Zone] = kwargs.pop("cls", None) _request = build_get_request( @@ -408,7 +405,7 @@ async def update( :param zone_name: The name of the DNS zone (without a terminating dot). Required. :type zone_name: str :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.ZoneUpdate + :type parameters: ~azure.mgmt.dns.models.ZoneUpdate :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. @@ -417,7 +414,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ @@ -448,7 +445,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ @@ -469,16 +466,16 @@ async def update( :type zone_name: str :param parameters: Parameters supplied to the Update operation. Is either a ZoneUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.ZoneUpdate or IO[bytes] + :type parameters: ~azure.mgmt.dns.models.ZoneUpdate or IO[bytes] :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. :type if_match: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +486,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Zone] = kwargs.pop("cls", None) @@ -536,7 +533,7 @@ async def update( @distributed_trace def list_by_resource_group( self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.Zone"]: + ) -> AsyncItemPaged["_models.Zone"]: """Lists the DNS zones within a resource group. :param resource_group_name: The name of the resource group. Required. @@ -545,16 +542,16 @@ def list_by_resource_group( record sets. Default value is None. :type top: int :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2018_05_01.models.Zone] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.models.Zone] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -584,7 +581,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -617,23 +614,23 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_models.Zone"]: + def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged["_models.Zone"]: """Lists the DNS zones in all resource groups in a subscription. :param top: The maximum number of DNS zones to return. If not specified, returns up to 100 zones. Default value is None. :type top: int :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2018_05_01.models.Zone] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.models.Zone] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -662,7 +659,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models.py deleted file mode 100644 index 24dd8b317f6a..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models.py +++ /dev/null @@ -1,7 +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. -# -------------------------------------------------------------------------- -from .v2018_05_01.models import * diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/__init__.py new file mode 100644 index 000000000000..3744d6d86253 --- /dev/null +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/__init__.py @@ -0,0 +1,76 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ARecord, + AaaaRecord, + CaaRecord, + CloudErrorBody, + CnameRecord, + DnsResourceReference, + DnsResourceReferenceRequest, + DnsResourceReferenceResult, + MxRecord, + NsRecord, + PtrRecord, + RecordSet, + RecordSetListResult, + RecordSetUpdateParameters, + Resource, + SoaRecord, + SrvRecord, + SubResource, + TxtRecord, + Zone, + ZoneListResult, + ZoneUpdate, +) + +from ._dns_management_client_enums import ( # type: ignore + RecordType, + ZoneType, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ARecord", + "AaaaRecord", + "CaaRecord", + "CloudErrorBody", + "CnameRecord", + "DnsResourceReference", + "DnsResourceReferenceRequest", + "DnsResourceReferenceResult", + "MxRecord", + "NsRecord", + "PtrRecord", + "RecordSet", + "RecordSetListResult", + "RecordSetUpdateParameters", + "Resource", + "SoaRecord", + "SrvRecord", + "SubResource", + "TxtRecord", + "Zone", + "ZoneListResult", + "ZoneUpdate", + "RecordType", + "ZoneType", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/_dns_management_client_enums.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/_dns_management_client_enums.py similarity index 100% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/_dns_management_client_enums.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/_dns_management_client_enums.py diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_models_py3.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/_models_py3.py similarity index 87% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_models_py3.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/_models_py3.py index bb9442c68ca0..a0cfd3f8239c 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_models_py3.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/_models_py3.py @@ -1,5 +1,4 @@ # coding=utf-8 -# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,10 +8,9 @@ from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from ... import _serialization +from .._utils import serialization as _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -103,7 +101,7 @@ class CloudErrorBody(_serialization.Model): error. :vartype target: str :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.dns.v2018_05_01.models.CloudErrorBody] + :vartype details: list[~azure.mgmt.dns.models.CloudErrorBody] """ _attribute_map = { @@ -133,7 +131,7 @@ def __init__( error. :paramtype target: str :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.dns.v2018_05_01.models.CloudErrorBody] + :paramtype details: list[~azure.mgmt.dns.models.CloudErrorBody] """ super().__init__(**kwargs) self.code = code @@ -166,10 +164,10 @@ class DnsResourceReference(_serialization.Model): """Represents a single Azure resource and its referencing DNS records. :ivar dns_resources: A list of dns Records. - :vartype dns_resources: list[~azure.mgmt.dns.v2018_05_01.models.SubResource] + :vartype dns_resources: list[~azure.mgmt.dns.models.SubResource] :ivar target_resource: A reference to an azure resource from where the dns resource value is taken. - :vartype target_resource: ~azure.mgmt.dns.v2018_05_01.models.SubResource + :vartype target_resource: ~azure.mgmt.dns.models.SubResource """ _attribute_map = { @@ -186,10 +184,10 @@ def __init__( ) -> None: """ :keyword dns_resources: A list of dns Records. - :paramtype dns_resources: list[~azure.mgmt.dns.v2018_05_01.models.SubResource] + :paramtype dns_resources: list[~azure.mgmt.dns.models.SubResource] :keyword target_resource: A reference to an azure resource from where the dns resource value is taken. - :paramtype target_resource: ~azure.mgmt.dns.v2018_05_01.models.SubResource + :paramtype target_resource: ~azure.mgmt.dns.models.SubResource """ super().__init__(**kwargs) self.dns_resources = dns_resources @@ -201,7 +199,7 @@ class DnsResourceReferenceRequest(_serialization.Model): :ivar target_resources: A list of references to azure resources for which referencing dns records need to be queried. - :vartype target_resources: list[~azure.mgmt.dns.v2018_05_01.models.SubResource] + :vartype target_resources: list[~azure.mgmt.dns.models.SubResource] """ _attribute_map = { @@ -212,7 +210,7 @@ def __init__(self, *, target_resources: Optional[List["_models.SubResource"]] = """ :keyword target_resources: A list of references to azure resources for which referencing dns records need to be queried. - :paramtype target_resources: list[~azure.mgmt.dns.v2018_05_01.models.SubResource] + :paramtype target_resources: list[~azure.mgmt.dns.models.SubResource] """ super().__init__(**kwargs) self.target_resources = target_resources @@ -223,7 +221,7 @@ class DnsResourceReferenceResult(_serialization.Model): :ivar dns_resource_references: The result of dns resource reference request. A list of dns resource references for each of the azure resource in the request. - :vartype dns_resource_references: list[~azure.mgmt.dns.v2018_05_01.models.DnsResourceReference] + :vartype dns_resource_references: list[~azure.mgmt.dns.models.DnsResourceReference] """ _attribute_map = { @@ -236,8 +234,7 @@ def __init__( """ :keyword dns_resource_references: The result of dns resource reference request. A list of dns resource references for each of the azure resource in the request. - :paramtype dns_resource_references: - list[~azure.mgmt.dns.v2018_05_01.models.DnsResourceReference] + :paramtype dns_resource_references: list[~azure.mgmt.dns.models.DnsResourceReference] """ super().__init__(**kwargs) self.dns_resource_references = dns_resource_references @@ -309,7 +306,7 @@ def __init__(self, *, ptrdname: Optional[str] = None, **kwargs: Any) -> None: self.ptrdname = ptrdname -class RecordSet(_serialization.Model): # pylint: disable=too-many-instance-attributes +class RecordSet(_serialization.Model): """Describes a DNS record set (a collection of DNS records with the same name and type). Variables are only populated by the server, and will be ignored when sending a request. @@ -332,27 +329,27 @@ class RecordSet(_serialization.Model): # pylint: disable=too-many-instance-attr :vartype provisioning_state: str :ivar target_resource: A reference to an azure resource from where the dns resource value is taken. - :vartype target_resource: ~azure.mgmt.dns.v2018_05_01.models.SubResource + :vartype target_resource: ~azure.mgmt.dns.models.SubResource :ivar a_records: The list of A records in the record set. - :vartype a_records: list[~azure.mgmt.dns.v2018_05_01.models.ARecord] + :vartype a_records: list[~azure.mgmt.dns.models.ARecord] :ivar aaaa_records: The list of AAAA records in the record set. - :vartype aaaa_records: list[~azure.mgmt.dns.v2018_05_01.models.AaaaRecord] + :vartype aaaa_records: list[~azure.mgmt.dns.models.AaaaRecord] :ivar mx_records: The list of MX records in the record set. - :vartype mx_records: list[~azure.mgmt.dns.v2018_05_01.models.MxRecord] + :vartype mx_records: list[~azure.mgmt.dns.models.MxRecord] :ivar ns_records: The list of NS records in the record set. - :vartype ns_records: list[~azure.mgmt.dns.v2018_05_01.models.NsRecord] + :vartype ns_records: list[~azure.mgmt.dns.models.NsRecord] :ivar ptr_records: The list of PTR records in the record set. - :vartype ptr_records: list[~azure.mgmt.dns.v2018_05_01.models.PtrRecord] + :vartype ptr_records: list[~azure.mgmt.dns.models.PtrRecord] :ivar srv_records: The list of SRV records in the record set. - :vartype srv_records: list[~azure.mgmt.dns.v2018_05_01.models.SrvRecord] + :vartype srv_records: list[~azure.mgmt.dns.models.SrvRecord] :ivar txt_records: The list of TXT records in the record set. - :vartype txt_records: list[~azure.mgmt.dns.v2018_05_01.models.TxtRecord] + :vartype txt_records: list[~azure.mgmt.dns.models.TxtRecord] :ivar cname_record: The CNAME record in the record set. - :vartype cname_record: ~azure.mgmt.dns.v2018_05_01.models.CnameRecord + :vartype cname_record: ~azure.mgmt.dns.models.CnameRecord :ivar soa_record: The SOA record in the record set. - :vartype soa_record: ~azure.mgmt.dns.v2018_05_01.models.SoaRecord + :vartype soa_record: ~azure.mgmt.dns.models.SoaRecord :ivar caa_records: The list of CAA records in the record set. - :vartype caa_records: list[~azure.mgmt.dns.v2018_05_01.models.CaaRecord] + :vartype caa_records: list[~azure.mgmt.dns.models.CaaRecord] """ _validation = { @@ -413,37 +410,37 @@ def __init__( :paramtype ttl: int :keyword target_resource: A reference to an azure resource from where the dns resource value is taken. - :paramtype target_resource: ~azure.mgmt.dns.v2018_05_01.models.SubResource + :paramtype target_resource: ~azure.mgmt.dns.models.SubResource :keyword a_records: The list of A records in the record set. - :paramtype a_records: list[~azure.mgmt.dns.v2018_05_01.models.ARecord] + :paramtype a_records: list[~azure.mgmt.dns.models.ARecord] :keyword aaaa_records: The list of AAAA records in the record set. - :paramtype aaaa_records: list[~azure.mgmt.dns.v2018_05_01.models.AaaaRecord] + :paramtype aaaa_records: list[~azure.mgmt.dns.models.AaaaRecord] :keyword mx_records: The list of MX records in the record set. - :paramtype mx_records: list[~azure.mgmt.dns.v2018_05_01.models.MxRecord] + :paramtype mx_records: list[~azure.mgmt.dns.models.MxRecord] :keyword ns_records: The list of NS records in the record set. - :paramtype ns_records: list[~azure.mgmt.dns.v2018_05_01.models.NsRecord] + :paramtype ns_records: list[~azure.mgmt.dns.models.NsRecord] :keyword ptr_records: The list of PTR records in the record set. - :paramtype ptr_records: list[~azure.mgmt.dns.v2018_05_01.models.PtrRecord] + :paramtype ptr_records: list[~azure.mgmt.dns.models.PtrRecord] :keyword srv_records: The list of SRV records in the record set. - :paramtype srv_records: list[~azure.mgmt.dns.v2018_05_01.models.SrvRecord] + :paramtype srv_records: list[~azure.mgmt.dns.models.SrvRecord] :keyword txt_records: The list of TXT records in the record set. - :paramtype txt_records: list[~azure.mgmt.dns.v2018_05_01.models.TxtRecord] + :paramtype txt_records: list[~azure.mgmt.dns.models.TxtRecord] :keyword cname_record: The CNAME record in the record set. - :paramtype cname_record: ~azure.mgmt.dns.v2018_05_01.models.CnameRecord + :paramtype cname_record: ~azure.mgmt.dns.models.CnameRecord :keyword soa_record: The SOA record in the record set. - :paramtype soa_record: ~azure.mgmt.dns.v2018_05_01.models.SoaRecord + :paramtype soa_record: ~azure.mgmt.dns.models.SoaRecord :keyword caa_records: The list of CAA records in the record set. - :paramtype caa_records: list[~azure.mgmt.dns.v2018_05_01.models.CaaRecord] + :paramtype caa_records: list[~azure.mgmt.dns.models.CaaRecord] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.etag = etag self.metadata = metadata self.ttl = ttl - self.fqdn = None - self.provisioning_state = None + self.fqdn: Optional[str] = None + self.provisioning_state: Optional[str] = None self.target_resource = target_resource self.a_records = a_records self.aaaa_records = aaaa_records @@ -463,7 +460,7 @@ class RecordSetListResult(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Information about the record sets in the response. - :vartype value: list[~azure.mgmt.dns.v2018_05_01.models.RecordSet] + :vartype value: list[~azure.mgmt.dns.models.RecordSet] :ivar next_link: The continuation token for the next page of results. :vartype next_link: str """ @@ -480,18 +477,18 @@ class RecordSetListResult(_serialization.Model): def __init__(self, *, value: Optional[List["_models.RecordSet"]] = None, **kwargs: Any) -> None: """ :keyword value: Information about the record sets in the response. - :paramtype value: list[~azure.mgmt.dns.v2018_05_01.models.RecordSet] + :paramtype value: list[~azure.mgmt.dns.models.RecordSet] """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class RecordSetUpdateParameters(_serialization.Model): """Parameters supplied to update a record set. :ivar record_set: Specifies information about the record set being updated. - :vartype record_set: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :vartype record_set: ~azure.mgmt.dns.models.RecordSet """ _attribute_map = { @@ -501,7 +498,7 @@ class RecordSetUpdateParameters(_serialization.Model): def __init__(self, *, record_set: Optional["_models.RecordSet"] = None, **kwargs: Any) -> None: """ :keyword record_set: Specifies information about the record set being updated. - :paramtype record_set: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :paramtype record_set: ~azure.mgmt.dns.models.RecordSet """ super().__init__(**kwargs) self.record_set = record_set @@ -549,9 +546,9 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -711,7 +708,7 @@ def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: self.value = value -class Zone(Resource): # pylint: disable=too-many-instance-attributes +class Zone(Resource): """Describes a DNS zone. Variables are only populated by the server, and will be ignored when sending a request. @@ -745,13 +742,13 @@ class Zone(Resource): # pylint: disable=too-many-instance-attributes :vartype name_servers: list[str] :ivar zone_type: The type of this DNS zone (Public or Private). Known values are: "Public" and "Private". - :vartype zone_type: str or ~azure.mgmt.dns.v2018_05_01.models.ZoneType + :vartype zone_type: str or ~azure.mgmt.dns.models.ZoneType :ivar registration_virtual_networks: A list of references to virtual networks that register hostnames in this DNS zone. This is a only when ZoneType is Private. - :vartype registration_virtual_networks: list[~azure.mgmt.dns.v2018_05_01.models.SubResource] + :vartype registration_virtual_networks: list[~azure.mgmt.dns.models.SubResource] :ivar resolution_virtual_networks: A list of references to virtual networks that resolve records in this DNS zone. This is a only when ZoneType is Private. - :vartype resolution_virtual_networks: list[~azure.mgmt.dns.v2018_05_01.models.SubResource] + :vartype resolution_virtual_networks: list[~azure.mgmt.dns.models.SubResource] """ _validation = { @@ -801,20 +798,20 @@ def __init__( :paramtype etag: str :keyword zone_type: The type of this DNS zone (Public or Private). Known values are: "Public" and "Private". - :paramtype zone_type: str or ~azure.mgmt.dns.v2018_05_01.models.ZoneType + :paramtype zone_type: str or ~azure.mgmt.dns.models.ZoneType :keyword registration_virtual_networks: A list of references to virtual networks that register hostnames in this DNS zone. This is a only when ZoneType is Private. - :paramtype registration_virtual_networks: list[~azure.mgmt.dns.v2018_05_01.models.SubResource] + :paramtype registration_virtual_networks: list[~azure.mgmt.dns.models.SubResource] :keyword resolution_virtual_networks: A list of references to virtual networks that resolve records in this DNS zone. This is a only when ZoneType is Private. - :paramtype resolution_virtual_networks: list[~azure.mgmt.dns.v2018_05_01.models.SubResource] + :paramtype resolution_virtual_networks: list[~azure.mgmt.dns.models.SubResource] """ super().__init__(location=location, tags=tags, **kwargs) self.etag = etag - self.max_number_of_record_sets = None - self.max_number_of_records_per_record_set = None - self.number_of_record_sets = None - self.name_servers = None + self.max_number_of_record_sets: Optional[int] = None + self.max_number_of_records_per_record_set: Optional[int] = None + self.number_of_record_sets: Optional[int] = None + self.name_servers: Optional[List[str]] = None self.zone_type = zone_type self.registration_virtual_networks = registration_virtual_networks self.resolution_virtual_networks = resolution_virtual_networks @@ -826,7 +823,7 @@ class ZoneListResult(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: Information about the DNS zones. - :vartype value: list[~azure.mgmt.dns.v2018_05_01.models.Zone] + :vartype value: list[~azure.mgmt.dns.models.Zone] :ivar next_link: The continuation token for the next page of results. :vartype next_link: str """ @@ -843,11 +840,11 @@ class ZoneListResult(_serialization.Model): def __init__(self, *, value: Optional[List["_models.Zone"]] = None, **kwargs: Any) -> None: """ :keyword value: Information about the DNS zones. - :paramtype value: list[~azure.mgmt.dns.v2018_05_01.models.Zone] + :paramtype value: list[~azure.mgmt.dns.models.Zone] """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ZoneUpdate(_serialization.Model): diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/_patch.py similarity index 61% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_patch.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_patch.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/models/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/__init__.py similarity index 63% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/__init__.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/__init__.py index bb9e9fe8e4bb..4fe60e6266e3 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/__init__.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/__init__.py @@ -5,13 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._record_sets_operations import RecordSetsOperations -from ._zones_operations import ZonesOperations -from ._dns_resource_reference_operations import DnsResourceReferenceOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._record_sets_operations import RecordSetsOperations # type: ignore +from ._zones_operations import ZonesOperations # type: ignore +from ._dns_resource_reference_operations import DnsResourceReferenceOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -19,5 +25,5 @@ "ZonesOperations", "DnsResourceReferenceOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_dns_resource_reference_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_dns_resource_reference_operations.py similarity index 82% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_dns_resource_reference_operations.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_dns_resource_reference_operations.py index 856306aafed0..d7fb9b58dc55 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_dns_resource_reference_operations.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_dns_resource_reference_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +25,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from .._configuration import DnsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -73,19 +70,18 @@ class DnsResourceReferenceOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2018_05_01.DnsManagementClient`'s + :class:`~azure.mgmt.dns.DnsManagementClient`'s :attr:`dns_resource_reference` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DnsManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def get_by_target_resources( @@ -94,12 +90,12 @@ def get_by_target_resources( """Returns the DNS records specified by the referencing targetResourceIds. :param parameters: Properties for dns resource reference request. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.DnsResourceReferenceRequest + :type parameters: ~azure.mgmt.dns.models.DnsResourceReferenceRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.DnsResourceReferenceResult + :rtype: ~azure.mgmt.dns.models.DnsResourceReferenceResult :raises ~azure.core.exceptions.HttpResponseError: """ @@ -115,7 +111,7 @@ def get_by_target_resources( Default value is "application/json". :paramtype content_type: str :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.DnsResourceReferenceResult + :rtype: ~azure.mgmt.dns.models.DnsResourceReferenceResult :raises ~azure.core.exceptions.HttpResponseError: """ @@ -127,12 +123,12 @@ def get_by_target_resources( :param parameters: Properties for dns resource reference request. Is either a DnsResourceReferenceRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.DnsResourceReferenceRequest or IO[bytes] + :type parameters: ~azure.mgmt.dns.models.DnsResourceReferenceRequest or IO[bytes] :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.DnsResourceReferenceResult + :rtype: ~azure.mgmt.dns.models.DnsResourceReferenceResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -143,7 +139,7 @@ def get_by_target_resources( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DnsResourceReferenceResult] = kwargs.pop("cls", None) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_patch.py new file mode 100644 index 000000000000..8bcb627aa475 --- /dev/null +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_patch.py @@ -0,0 +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. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_record_sets_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_record_sets_operations.py similarity index 91% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_record_sets_operations.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_record_sets_operations.py index 7232a6e75770..3599644f784b 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_record_sets_operations.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_record_sets_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from .._configuration import DnsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +59,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -109,7 +107,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -157,7 +155,7 @@ def build_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -199,7 +197,7 @@ def build_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -241,7 +239,7 @@ def build_list_by_type_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -283,7 +281,7 @@ def build_list_by_dns_zone_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -324,7 +322,7 @@ def build_list_all_by_dns_zone_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/all", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -352,19 +350,18 @@ class RecordSetsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2018_05_01.DnsManagementClient`'s + :class:`~azure.mgmt.dns.DnsManagementClient`'s :attr:`record_sets` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DnsManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def update( @@ -390,9 +387,9 @@ def update( :type relative_record_set_name: str :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :type parameters: ~azure.mgmt.dns.models.RecordSet :param if_match: The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent changes. Default value is None. @@ -401,7 +398,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -429,7 +426,7 @@ def update( :type relative_record_set_name: str :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the Update operation. Required. :type parameters: IO[bytes] :param if_match: The etag of the record set. Omit this value to always overwrite the current @@ -440,7 +437,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -466,19 +463,19 @@ def update( :type relative_record_set_name: str :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the Update operation. Is either a RecordSet type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.RecordSet or IO[bytes] + :type parameters: ~azure.mgmt.dns.models.RecordSet or IO[bytes] :param if_match: The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent changes. Default value is None. :type if_match: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +486,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) @@ -561,9 +558,9 @@ def create_or_update( :param record_type: The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :type parameters: ~azure.mgmt.dns.models.RecordSet :param if_match: The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. @@ -575,7 +572,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -605,7 +602,7 @@ def create_or_update( :param record_type: The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. :type parameters: IO[bytes] :param if_match: The etag of the record set. Omit this value to always overwrite the current @@ -619,7 +616,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ @@ -647,10 +644,10 @@ def create_or_update( :param record_type: The type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the DNS zone is created). Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a RecordSet type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.RecordSet or IO[bytes] + :type parameters: ~azure.mgmt.dns.models.RecordSet or IO[bytes] :param if_match: The etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. @@ -659,10 +656,10 @@ def create_or_update( updating an existing record set. Other values will be ignored. Default value is None. :type if_none_match: str :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -673,7 +670,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) @@ -742,7 +739,7 @@ def delete( # pylint: disable=inconsistent-return-statements :param record_type: The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is deleted). Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param if_match: The etag of the record set. Omit this value to always delete the current record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. Default value is None. @@ -751,7 +748,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -762,7 +759,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -812,12 +809,12 @@ def get( :type relative_record_set_name: str :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.RecordSet + :rtype: ~azure.mgmt.dns.models.RecordSet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -828,7 +825,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) _request = build_get_request( @@ -870,7 +867,7 @@ def list_by_type( top: Optional[int] = None, recordsetnamesuffix: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RecordSet"]: + ) -> ItemPaged["_models.RecordSet"]: """Lists the record sets of a specified type in a DNS zone. :param resource_group_name: The name of the resource group. Required. @@ -879,25 +876,25 @@ def list_by_type( :type zone_name: str :param record_type: The type of record sets to enumerate. Known values are: "A", "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_05_01.models.RecordType + :type record_type: str or ~azure.mgmt.dns.models.RecordType :param top: The maximum number of record sets to return. If not specified, returns up to 100 record sets. Default value is None. :type top: int :param recordsetnamesuffix: The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. + only records that end with .\\ :code:``. Default value is None. :type recordsetnamesuffix: str :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2018_05_01.models.RecordSet] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.models.RecordSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -930,7 +927,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -970,7 +967,7 @@ def list_by_dns_zone( top: Optional[int] = None, recordsetnamesuffix: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RecordSet"]: + ) -> ItemPaged["_models.RecordSet"]: """Lists all record sets in a DNS zone. :param resource_group_name: The name of the resource group. Required. @@ -982,19 +979,19 @@ def list_by_dns_zone( :type top: int :param recordsetnamesuffix: The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. + only records that end with .\\ :code:``. Default value is None. :type recordsetnamesuffix: str :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2018_05_01.models.RecordSet] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.models.RecordSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1026,7 +1023,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -1066,7 +1063,7 @@ def list_all_by_dns_zone( top: Optional[int] = None, record_set_name_suffix: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.RecordSet"]: + ) -> ItemPaged["_models.RecordSet"]: """Lists all record sets in a DNS zone. :param resource_group_name: The name of the resource group. Required. @@ -1078,19 +1075,19 @@ def list_all_by_dns_zone( :type top: int :param record_set_name_suffix: The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. + only records that end with .\\ :code:``. Default value is None. :type record_set_name_suffix: str :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2018_05_01.models.RecordSet] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.models.RecordSet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1122,7 +1119,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_zones_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_zones_operations.py similarity index 92% rename from sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_zones_operations.py rename to sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_zones_operations.py index 5b6c0f5941ec..6ef13568bd42 100644 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_zones_operations.py +++ b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/operations/_zones_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from .._configuration import DnsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +62,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -101,7 +99,7 @@ def build_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -132,7 +130,7 @@ def build_get_request(resource_group_name: str, zone_name: str, subscription_id: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -164,7 +162,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), @@ -199,7 +197,7 @@ def build_list_by_resource_group_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -250,19 +248,18 @@ class ZonesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2018_05_01.DnsManagementClient`'s + :class:`~azure.mgmt.dns.DnsManagementClient`'s :attr:`zones` attribute. """ models = _models - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DnsManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def create_or_update( @@ -283,7 +280,7 @@ def create_or_update( :param zone_name: The name of the DNS zone (without a terminating dot). Required. :type zone_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.Zone + :type parameters: ~azure.mgmt.dns.models.Zone :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. @@ -295,7 +292,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ @@ -330,7 +327,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ @@ -352,7 +349,7 @@ def create_or_update( :type zone_name: str :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a Zone type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.Zone or IO[bytes] + :type parameters: ~azure.mgmt.dns.models.Zone or IO[bytes] :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. @@ -361,10 +358,10 @@ def create_or_update( an existing zone. Other values will be ignored. Default value is None. :type if_none_match: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -375,7 +372,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Zone] = kwargs.pop("cls", None) @@ -423,7 +420,7 @@ def create_or_update( def _delete_initial( self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,7 +431,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -493,7 +490,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -540,10 +537,10 @@ def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _model :param zone_name: The name of the DNS zone (without a terminating dot). Required. :type zone_name: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -554,7 +551,7 @@ def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Zone] = kwargs.pop("cls", None) _request = build_get_request( @@ -603,7 +600,7 @@ def update( :param zone_name: The name of the DNS zone (without a terminating dot). Required. :type zone_name: str :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.ZoneUpdate + :type parameters: ~azure.mgmt.dns.models.ZoneUpdate :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. @@ -612,7 +609,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ @@ -643,7 +640,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ @@ -664,16 +661,16 @@ def update( :type zone_name: str :param parameters: Parameters supplied to the Update operation. Is either a ZoneUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_05_01.models.ZoneUpdate or IO[bytes] + :type parameters: ~azure.mgmt.dns.models.ZoneUpdate or IO[bytes] :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent changes. Default value is None. :type if_match: str :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_05_01.models.Zone + :rtype: ~azure.mgmt.dns.models.Zone :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -684,7 +681,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Zone] = kwargs.pop("cls", None) @@ -731,7 +728,7 @@ def update( @distributed_trace def list_by_resource_group( self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.Zone"]: + ) -> ItemPaged["_models.Zone"]: """Lists the DNS zones within a resource group. :param resource_group_name: The name of the resource group. Required. @@ -740,16 +737,16 @@ def list_by_resource_group( record sets. Default value is None. :type top: int :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2018_05_01.models.Zone] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.models.Zone] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -779,7 +776,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -812,23 +809,23 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Zone"]: + def list(self, top: Optional[int] = None, **kwargs: Any) -> ItemPaged["_models.Zone"]: """Lists the DNS zones in all resource groups in a subscription. :param top: The maximum number of DNS zones to return. If not specified, returns up to 100 zones. Default value is None. :type top: int :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2018_05_01.models.Zone] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.models.Zone] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -857,7 +854,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/__init__.py deleted file mode 100644 index 23ee0cabde53..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/__init__.py +++ /dev/null @@ -1,26 +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 ._dns_management_client import DnsManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DnsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_configuration.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_configuration.py deleted file mode 100644 index b21a767e800c..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class DnsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for DnsManagementClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2016-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2016-04-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-dns/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_dns_management_client.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_dns_management_client.py deleted file mode 100644 index f9c42b56e8a7..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_dns_management_client.py +++ /dev/null @@ -1,117 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import DnsManagementClientConfiguration -from .operations import RecordSetsOperations, ZonesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class DnsManagementClient: # pylint: disable=client-accepts-api-version-keyword - """The DNS Management Client. - - :ivar record_sets: RecordSetsOperations operations - :vartype record_sets: azure.mgmt.dns.v2016_04_01.operations.RecordSetsOperations - :ivar zones: ZonesOperations operations - :vartype zones: azure.mgmt.dns.v2016_04_01.operations.ZonesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2016-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = DnsManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.record_sets = RecordSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2016-04-01" - ) - self.zones = ZonesOperations(self._client, self._config, self._serialize, self._deserialize, "2016-04-01") - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_metadata.json b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_metadata.json deleted file mode 100644 index 729ddded8d49..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/_metadata.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "chosen_version": "2016-04-01", - "total_api_version_list": ["2016-04-01"], - "client": { - "name": "DnsManagementClient", - "filename": "_dns_management_client", - "description": "The DNS Management Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DnsManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DnsManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "record_sets": "RecordSetsOperations", - "zones": "ZonesOperations" - } -} diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/__init__.py deleted file mode 100644 index e94042023e78..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/__init__.py +++ /dev/null @@ -1,23 +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 ._dns_management_client import DnsManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DnsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_configuration.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_configuration.py deleted file mode 100644 index 0868596e9bd4..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class DnsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for DnsManagementClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2016-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2016-04-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-dns/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_dns_management_client.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_dns_management_client.py deleted file mode 100644 index 967f2c52755b..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/_dns_management_client.py +++ /dev/null @@ -1,119 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import DnsManagementClientConfiguration -from .operations import RecordSetsOperations, ZonesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class DnsManagementClient: # pylint: disable=client-accepts-api-version-keyword - """The DNS Management Client. - - :ivar record_sets: RecordSetsOperations operations - :vartype record_sets: azure.mgmt.dns.v2016_04_01.aio.operations.RecordSetsOperations - :ivar zones: ZonesOperations operations - :vartype zones: azure.mgmt.dns.v2016_04_01.aio.operations.ZonesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2016-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = DnsManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.record_sets = RecordSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2016-04-01" - ) - self.zones = ZonesOperations(self._client, self._config, self._serialize, self._deserialize, "2016-04-01") - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/__init__.py deleted file mode 100644 index c12bcc6610ed..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/__init__.py +++ /dev/null @@ -1,21 +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 ._record_sets_operations import RecordSetsOperations -from ._zones_operations import ZonesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "RecordSetsOperations", - "ZonesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_record_sets_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_record_sets_operations.py deleted file mode 100644 index 60693401fd92..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_record_sets_operations.py +++ /dev/null @@ -1,768 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._record_sets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_dns_zone_request, - build_list_by_type_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RecordSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2016_04_01.aio.DnsManagementClient`'s - :attr:`record_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - async def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the Update operation. Is either a RecordSet type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a RecordSet - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - if_match: Optional[str] = None, - **kwargs: Any - ) -> None: - """Deletes a record set from a DNS zone. This operation cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA cannot - be deleted (they are deleted when the DNS zone is deleted). Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param if_match: The etag of the record set. Omit this value to always delete the current - record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent - changes. Default value is None. - :type if_match: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - **kwargs: Any - ) -> _models.RecordSet: - """Gets a record set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_type( - self, - resource_group_name: str, - zone_name: str, - record_type: Union[str, _models.RecordType], - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: - """Lists the record sets of a specified type in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param record_type: The type of record sets to enumerate. Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2016_04_01.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_type_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_dns_zone( - self, - resource_group_name: str, - zone_name: str, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: - """Lists all record sets in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2016_04_01.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_zones_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_zones_operations.py deleted file mode 100644 index e358d31fba68..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/aio/operations/_zones_operations.py +++ /dev/null @@ -1,562 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._zones_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ZonesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2016_04_01.aio.DnsManagementClient`'s - :attr:`zones` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: _models.Zone, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.Zone - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: Union[_models.Zone, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a Zone type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.Zone or IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Zone") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.ZoneDeleteResult]: - """Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation - cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param if_match: The etag of the DNS zone. Omit this value to always delete the current zone. - Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. - Default value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either ZoneDeleteResult or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dns.v2016_04_01.models.ZoneDeleteResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.ZoneDeleteResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - zone_name=zone_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ZoneDeleteResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ZoneDeleteResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ZoneDeleteResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _models.Zone: - """Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.Zone"]: - """Lists the DNS zones within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2016_04_01.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_models.Zone"]: - """Lists the DNS zones in all resource groups in a subscription. - - :param top: The maximum number of DNS zones to return. If not specified, returns up to 100 - zones. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2016_04_01.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/__init__.py deleted file mode 100644 index a50864993003..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import ARecord -from ._models_py3 import AaaaRecord -from ._models_py3 import CloudErrorBody -from ._models_py3 import CnameRecord -from ._models_py3 import MxRecord -from ._models_py3 import NsRecord -from ._models_py3 import PtrRecord -from ._models_py3 import RecordSet -from ._models_py3 import RecordSetListResult -from ._models_py3 import RecordSetUpdateParameters -from ._models_py3 import Resource -from ._models_py3 import SoaRecord -from ._models_py3 import SrvRecord -from ._models_py3 import SubResource -from ._models_py3 import TrackedResource -from ._models_py3 import TxtRecord -from ._models_py3 import Zone -from ._models_py3 import ZoneDeleteResult -from ._models_py3 import ZoneListResult - -from ._dns_management_client_enums import HttpStatusCode -from ._dns_management_client_enums import OperationStatus -from ._dns_management_client_enums import RecordType -from ._dns_management_client_enums import ZoneType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ARecord", - "AaaaRecord", - "CloudErrorBody", - "CnameRecord", - "MxRecord", - "NsRecord", - "PtrRecord", - "RecordSet", - "RecordSetListResult", - "RecordSetUpdateParameters", - "Resource", - "SoaRecord", - "SrvRecord", - "SubResource", - "TrackedResource", - "TxtRecord", - "Zone", - "ZoneDeleteResult", - "ZoneListResult", - "HttpStatusCode", - "OperationStatus", - "RecordType", - "ZoneType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_dns_management_client_enums.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_dns_management_client_enums.py deleted file mode 100644 index 55e4f7f4d557..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_dns_management_client_enums.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 enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """HttpStatusCode.""" - - CONTINUE = "Continue" - SWITCHING_PROTOCOLS = "SwitchingProtocols" - OK = "OK" - CREATED = "Created" - ACCEPTED = "Accepted" - NON_AUTHORITATIVE_INFORMATION = "NonAuthoritativeInformation" - NO_CONTENT = "NoContent" - RESET_CONTENT = "ResetContent" - PARTIAL_CONTENT = "PartialContent" - MULTIPLE_CHOICES = "MultipleChoices" - AMBIGUOUS = "Ambiguous" - MOVED_PERMANENTLY = "MovedPermanently" - MOVED = "Moved" - FOUND = "Found" - REDIRECT = "Redirect" - SEE_OTHER = "SeeOther" - REDIRECT_METHOD = "RedirectMethod" - NOT_MODIFIED = "NotModified" - USE_PROXY = "UseProxy" - UNUSED = "Unused" - TEMPORARY_REDIRECT = "TemporaryRedirect" - REDIRECT_KEEP_VERB = "RedirectKeepVerb" - BAD_REQUEST = "BadRequest" - UNAUTHORIZED = "Unauthorized" - PAYMENT_REQUIRED = "PaymentRequired" - FORBIDDEN = "Forbidden" - NOT_FOUND = "NotFound" - METHOD_NOT_ALLOWED = "MethodNotAllowed" - NOT_ACCEPTABLE = "NotAcceptable" - PROXY_AUTHENTICATION_REQUIRED = "ProxyAuthenticationRequired" - REQUEST_TIMEOUT = "RequestTimeout" - CONFLICT = "Conflict" - GONE = "Gone" - LENGTH_REQUIRED = "LengthRequired" - PRECONDITION_FAILED = "PreconditionFailed" - REQUEST_ENTITY_TOO_LARGE = "RequestEntityTooLarge" - REQUEST_URI_TOO_LONG = "RequestUriTooLong" - UNSUPPORTED_MEDIA_TYPE = "UnsupportedMediaType" - REQUESTED_RANGE_NOT_SATISFIABLE = "RequestedRangeNotSatisfiable" - EXPECTATION_FAILED = "ExpectationFailed" - UPGRADE_REQUIRED = "UpgradeRequired" - INTERNAL_SERVER_ERROR = "InternalServerError" - NOT_IMPLEMENTED = "NotImplemented" - BAD_GATEWAY = "BadGateway" - SERVICE_UNAVAILABLE = "ServiceUnavailable" - GATEWAY_TIMEOUT = "GatewayTimeout" - HTTP_VERSION_NOT_SUPPORTED = "HttpVersionNotSupported" - CONTINUE_ENUM = "Continue" - - -class OperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """OperationStatus.""" - - IN_PROGRESS = "InProgress" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class RecordType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RecordType.""" - - A = "A" - AAAA = "AAAA" - CNAME = "CNAME" - MX = "MX" - NS = "NS" - PTR = "PTR" - SOA = "SOA" - SRV = "SRV" - TXT = "TXT" - - -class ZoneType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of this DNS zone (Public or Private).""" - - PUBLIC = "Public" - PRIVATE = "Private" diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_models_py3.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_models_py3.py deleted file mode 100644 index 338c5ae79dcd..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/models/_models_py3.py +++ /dev/null @@ -1,807 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license 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, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AaaaRecord(_serialization.Model): - """An AAAA record. - - :ivar ipv6_address: The IPv6 address of this AAAA record. - :vartype ipv6_address: str - """ - - _attribute_map = { - "ipv6_address": {"key": "ipv6Address", "type": "str"}, - } - - def __init__(self, *, ipv6_address: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ipv6_address: The IPv6 address of this AAAA record. - :paramtype ipv6_address: str - """ - super().__init__(**kwargs) - self.ipv6_address = ipv6_address - - -class ARecord(_serialization.Model): - """An A record. - - :ivar ipv4_address: The IPv4 address of this A record. - :vartype ipv4_address: str - """ - - _attribute_map = { - "ipv4_address": {"key": "ipv4Address", "type": "str"}, - } - - def __init__(self, *, ipv4_address: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ipv4_address: The IPv4 address of this A record. - :paramtype ipv4_address: str - """ - super().__init__(**kwargs) - self.ipv4_address = ipv4_address - - -class CloudErrorBody(_serialization.Model): - """An error response from the service. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.dns.v2016_04_01.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.dns.v2016_04_01.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class CnameRecord(_serialization.Model): - """A CNAME record. - - :ivar cname: The canonical name for this CNAME record. - :vartype cname: str - """ - - _attribute_map = { - "cname": {"key": "cname", "type": "str"}, - } - - def __init__(self, *, cname: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword cname: The canonical name for this CNAME record. - :paramtype cname: str - """ - super().__init__(**kwargs) - self.cname = cname - - -class MxRecord(_serialization.Model): - """An MX record. - - :ivar preference: The preference value for this MX record. - :vartype preference: int - :ivar exchange: The domain name of the mail host for this MX record. - :vartype exchange: str - """ - - _attribute_map = { - "preference": {"key": "preference", "type": "int"}, - "exchange": {"key": "exchange", "type": "str"}, - } - - def __init__(self, *, preference: Optional[int] = None, exchange: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword preference: The preference value for this MX record. - :paramtype preference: int - :keyword exchange: The domain name of the mail host for this MX record. - :paramtype exchange: str - """ - super().__init__(**kwargs) - self.preference = preference - self.exchange = exchange - - -class NsRecord(_serialization.Model): - """An NS record. - - :ivar nsdname: The name server name for this NS record. - :vartype nsdname: str - """ - - _attribute_map = { - "nsdname": {"key": "nsdname", "type": "str"}, - } - - def __init__(self, *, nsdname: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword nsdname: The name server name for this NS record. - :paramtype nsdname: str - """ - super().__init__(**kwargs) - self.nsdname = nsdname - - -class PtrRecord(_serialization.Model): - """A PTR record. - - :ivar ptrdname: The PTR target domain name for this PTR record. - :vartype ptrdname: str - """ - - _attribute_map = { - "ptrdname": {"key": "ptrdname", "type": "str"}, - } - - def __init__(self, *, ptrdname: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ptrdname: The PTR target domain name for this PTR record. - :paramtype ptrdname: str - """ - super().__init__(**kwargs) - self.ptrdname = ptrdname - - -class RecordSet(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Describes a DNS record set (a collection of DNS records with the same name and type). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the record set. - :vartype id: str - :ivar name: The name of the record set. - :vartype name: str - :ivar type: The type of the record set. - :vartype type: str - :ivar etag: The etag of the record set. - :vartype etag: str - :ivar metadata: The metadata attached to the record set. - :vartype metadata: dict[str, str] - :ivar ttl: The TTL (time-to-live) of the records in the record set. - :vartype ttl: int - :ivar fqdn: Fully qualified domain name of the record set. - :vartype fqdn: str - :ivar a_records: The list of A records in the record set. - :vartype a_records: list[~azure.mgmt.dns.v2016_04_01.models.ARecord] - :ivar aaaa_records: The list of AAAA records in the record set. - :vartype aaaa_records: list[~azure.mgmt.dns.v2016_04_01.models.AaaaRecord] - :ivar mx_records: The list of MX records in the record set. - :vartype mx_records: list[~azure.mgmt.dns.v2016_04_01.models.MxRecord] - :ivar ns_records: The list of NS records in the record set. - :vartype ns_records: list[~azure.mgmt.dns.v2016_04_01.models.NsRecord] - :ivar ptr_records: The list of PTR records in the record set. - :vartype ptr_records: list[~azure.mgmt.dns.v2016_04_01.models.PtrRecord] - :ivar srv_records: The list of SRV records in the record set. - :vartype srv_records: list[~azure.mgmt.dns.v2016_04_01.models.SrvRecord] - :ivar txt_records: The list of TXT records in the record set. - :vartype txt_records: list[~azure.mgmt.dns.v2016_04_01.models.TxtRecord] - :ivar cname_record: The CNAME record in the record set. - :vartype cname_record: ~azure.mgmt.dns.v2016_04_01.models.CnameRecord - :ivar soa_record: The SOA record in the record set. - :vartype soa_record: ~azure.mgmt.dns.v2016_04_01.models.SoaRecord - """ - - _validation = { - "fqdn": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "metadata": {"key": "properties.metadata", "type": "{str}"}, - "ttl": {"key": "properties.TTL", "type": "int"}, - "fqdn": {"key": "properties.fqdn", "type": "str"}, - "a_records": {"key": "properties.ARecords", "type": "[ARecord]"}, - "aaaa_records": {"key": "properties.AAAARecords", "type": "[AaaaRecord]"}, - "mx_records": {"key": "properties.MXRecords", "type": "[MxRecord]"}, - "ns_records": {"key": "properties.NSRecords", "type": "[NsRecord]"}, - "ptr_records": {"key": "properties.PTRRecords", "type": "[PtrRecord]"}, - "srv_records": {"key": "properties.SRVRecords", "type": "[SrvRecord]"}, - "txt_records": {"key": "properties.TXTRecords", "type": "[TxtRecord]"}, - "cname_record": {"key": "properties.CNAMERecord", "type": "CnameRecord"}, - "soa_record": {"key": "properties.SOARecord", "type": "SoaRecord"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - etag: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - ttl: Optional[int] = None, - a_records: Optional[List["_models.ARecord"]] = None, - aaaa_records: Optional[List["_models.AaaaRecord"]] = None, - mx_records: Optional[List["_models.MxRecord"]] = None, - ns_records: Optional[List["_models.NsRecord"]] = None, - ptr_records: Optional[List["_models.PtrRecord"]] = None, - srv_records: Optional[List["_models.SrvRecord"]] = None, - txt_records: Optional[List["_models.TxtRecord"]] = None, - cname_record: Optional["_models.CnameRecord"] = None, - soa_record: Optional["_models.SoaRecord"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The ID of the record set. - :paramtype id: str - :keyword name: The name of the record set. - :paramtype name: str - :keyword type: The type of the record set. - :paramtype type: str - :keyword etag: The etag of the record set. - :paramtype etag: str - :keyword metadata: The metadata attached to the record set. - :paramtype metadata: dict[str, str] - :keyword ttl: The TTL (time-to-live) of the records in the record set. - :paramtype ttl: int - :keyword a_records: The list of A records in the record set. - :paramtype a_records: list[~azure.mgmt.dns.v2016_04_01.models.ARecord] - :keyword aaaa_records: The list of AAAA records in the record set. - :paramtype aaaa_records: list[~azure.mgmt.dns.v2016_04_01.models.AaaaRecord] - :keyword mx_records: The list of MX records in the record set. - :paramtype mx_records: list[~azure.mgmt.dns.v2016_04_01.models.MxRecord] - :keyword ns_records: The list of NS records in the record set. - :paramtype ns_records: list[~azure.mgmt.dns.v2016_04_01.models.NsRecord] - :keyword ptr_records: The list of PTR records in the record set. - :paramtype ptr_records: list[~azure.mgmt.dns.v2016_04_01.models.PtrRecord] - :keyword srv_records: The list of SRV records in the record set. - :paramtype srv_records: list[~azure.mgmt.dns.v2016_04_01.models.SrvRecord] - :keyword txt_records: The list of TXT records in the record set. - :paramtype txt_records: list[~azure.mgmt.dns.v2016_04_01.models.TxtRecord] - :keyword cname_record: The CNAME record in the record set. - :paramtype cname_record: ~azure.mgmt.dns.v2016_04_01.models.CnameRecord - :keyword soa_record: The SOA record in the record set. - :paramtype soa_record: ~azure.mgmt.dns.v2016_04_01.models.SoaRecord - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.etag = etag - self.metadata = metadata - self.ttl = ttl - self.fqdn = None - self.a_records = a_records - self.aaaa_records = aaaa_records - self.mx_records = mx_records - self.ns_records = ns_records - self.ptr_records = ptr_records - self.srv_records = srv_records - self.txt_records = txt_records - self.cname_record = cname_record - self.soa_record = soa_record - - -class RecordSetListResult(_serialization.Model): - """The response to a record set List operation. - - :ivar value: Information about the record sets in the response. - :vartype value: list[~azure.mgmt.dns.v2016_04_01.models.RecordSet] - :ivar next_link: The continuation token for the next page of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RecordSet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.RecordSet"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Information about the record sets in the response. - :paramtype value: list[~azure.mgmt.dns.v2016_04_01.models.RecordSet] - :keyword next_link: The continuation token for the next page of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RecordSetUpdateParameters(_serialization.Model): - """Parameters supplied to update a record set. - - :ivar record_set: Specifies information about the record set being updated. - :vartype record_set: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - """ - - _attribute_map = { - "record_set": {"key": "RecordSet", "type": "RecordSet"}, - } - - def __init__(self, *, record_set: Optional["_models.RecordSet"] = None, **kwargs: Any) -> None: - """ - :keyword record_set: Specifies information about the record set being updated. - :paramtype record_set: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - """ - super().__init__(**kwargs) - self.record_set = record_set - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class SoaRecord(_serialization.Model): - """An SOA record. - - :ivar host: The domain name of the authoritative name server for this SOA record. - :vartype host: str - :ivar email: The email contact for this SOA record. - :vartype email: str - :ivar serial_number: The serial number for this SOA record. - :vartype serial_number: int - :ivar refresh_time: The refresh value for this SOA record. - :vartype refresh_time: int - :ivar retry_time: The retry time for this SOA record. - :vartype retry_time: int - :ivar expire_time: The expire time for this SOA record. - :vartype expire_time: int - :ivar minimum_ttl: The minimum value for this SOA record. By convention this is used to - determine the negative caching duration. - :vartype minimum_ttl: int - """ - - _attribute_map = { - "host": {"key": "host", "type": "str"}, - "email": {"key": "email", "type": "str"}, - "serial_number": {"key": "serialNumber", "type": "int"}, - "refresh_time": {"key": "refreshTime", "type": "int"}, - "retry_time": {"key": "retryTime", "type": "int"}, - "expire_time": {"key": "expireTime", "type": "int"}, - "minimum_ttl": {"key": "minimumTTL", "type": "int"}, - } - - def __init__( - self, - *, - host: Optional[str] = None, - email: Optional[str] = None, - serial_number: Optional[int] = None, - refresh_time: Optional[int] = None, - retry_time: Optional[int] = None, - expire_time: Optional[int] = None, - minimum_ttl: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword host: The domain name of the authoritative name server for this SOA record. - :paramtype host: str - :keyword email: The email contact for this SOA record. - :paramtype email: str - :keyword serial_number: The serial number for this SOA record. - :paramtype serial_number: int - :keyword refresh_time: The refresh value for this SOA record. - :paramtype refresh_time: int - :keyword retry_time: The retry time for this SOA record. - :paramtype retry_time: int - :keyword expire_time: The expire time for this SOA record. - :paramtype expire_time: int - :keyword minimum_ttl: The minimum value for this SOA record. By convention this is used to - determine the negative caching duration. - :paramtype minimum_ttl: int - """ - super().__init__(**kwargs) - self.host = host - self.email = email - self.serial_number = serial_number - self.refresh_time = refresh_time - self.retry_time = retry_time - self.expire_time = expire_time - self.minimum_ttl = minimum_ttl - - -class SrvRecord(_serialization.Model): - """An SRV record. - - :ivar priority: The priority value for this SRV record. - :vartype priority: int - :ivar weight: The weight value for this SRV record. - :vartype weight: int - :ivar port: The port value for this SRV record. - :vartype port: int - :ivar target: The target domain name for this SRV record. - :vartype target: str - """ - - _attribute_map = { - "priority": {"key": "priority", "type": "int"}, - "weight": {"key": "weight", "type": "int"}, - "port": {"key": "port", "type": "int"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__( - self, - *, - priority: Optional[int] = None, - weight: Optional[int] = None, - port: Optional[int] = None, - target: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword priority: The priority value for this SRV record. - :paramtype priority: int - :keyword weight: The weight value for this SRV record. - :paramtype weight: int - :keyword port: The port value for this SRV record. - :paramtype port: int - :keyword target: The target domain name for this SRV record. - :paramtype target: str - """ - super().__init__(**kwargs) - self.priority = priority - self.weight = weight - self.port = port - self.target = target - - -class SubResource(_serialization.Model): - """SubResource. - - :ivar id: Resource Id. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Resource Id. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class TxtRecord(_serialization.Model): - """A TXT record. - - :ivar value: The text value of this TXT record. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: The text value of this TXT record. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class Zone(TrackedResource): # pylint: disable=too-many-instance-attributes - """Describes a DNS zone. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar etag: The etag of the zone. - :vartype etag: str - :ivar max_number_of_record_sets: The maximum number of record sets that can be created in this - DNS zone. This is a read-only property and any attempt to set this value will be ignored. - :vartype max_number_of_record_sets: int - :ivar max_number_of_records_per_record_set: The maximum number of records per record set that - can be created in this DNS zone. This is a read-only property and any attempt to set this - value will be ignored. - :vartype max_number_of_records_per_record_set: int - :ivar number_of_record_sets: The current number of record sets in this DNS zone. This is a - read-only property and any attempt to set this value will be ignored. - :vartype number_of_record_sets: int - :ivar name_servers: The name servers for this DNS zone. This is a read-only property and any - attempt to set this value will be ignored. - :vartype name_servers: list[str] - :ivar zone_type: The type of this DNS zone (Public or Private). Known values are: "Public" and - "Private". - :vartype zone_type: str or ~azure.mgmt.dns.v2016_04_01.models.ZoneType - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "max_number_of_records_per_record_set": {"readonly": True}, - "name_servers": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "max_number_of_record_sets": {"key": "properties.maxNumberOfRecordSets", "type": "int"}, - "max_number_of_records_per_record_set": {"key": "properties.maxNumberOfRecordsPerRecordSet", "type": "int"}, - "number_of_record_sets": {"key": "properties.numberOfRecordSets", "type": "int"}, - "name_servers": {"key": "properties.nameServers", "type": "[str]"}, - "zone_type": {"key": "properties.zoneType", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - etag: Optional[str] = None, - max_number_of_record_sets: Optional[int] = None, - number_of_record_sets: Optional[int] = None, - zone_type: Union[str, "_models.ZoneType"] = "Public", - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword etag: The etag of the zone. - :paramtype etag: str - :keyword max_number_of_record_sets: The maximum number of record sets that can be created in - this DNS zone. This is a read-only property and any attempt to set this value will be ignored. - :paramtype max_number_of_record_sets: int - :keyword number_of_record_sets: The current number of record sets in this DNS zone. This is a - read-only property and any attempt to set this value will be ignored. - :paramtype number_of_record_sets: int - :keyword zone_type: The type of this DNS zone (Public or Private). Known values are: "Public" - and "Private". - :paramtype zone_type: str or ~azure.mgmt.dns.v2016_04_01.models.ZoneType - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag = etag - self.max_number_of_record_sets = max_number_of_record_sets - self.max_number_of_records_per_record_set = None - self.number_of_record_sets = number_of_record_sets - self.name_servers = None - self.zone_type = zone_type - - -class ZoneDeleteResult(_serialization.Model): - """The response to a Zone Delete operation. - - :ivar azure_async_operation: Users can perform a Get on Azure-AsyncOperation to get the status - of their delete Zone operations. - :vartype azure_async_operation: str - :ivar status: Known values are: "InProgress", "Succeeded", and "Failed". - :vartype status: str or ~azure.mgmt.dns.v2016_04_01.models.OperationStatus - :ivar status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created", - "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", - "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", - "RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb", - "BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", - "NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", - "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", - "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", - "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", - "HttpVersionNotSupported", and "Continue". - :vartype status_code: str or ~azure.mgmt.dns.v2016_04_01.models.HttpStatusCode - :ivar request_id: - :vartype request_id: str - """ - - _attribute_map = { - "azure_async_operation": {"key": "azureAsyncOperation", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "status_code": {"key": "statusCode", "type": "str"}, - "request_id": {"key": "requestId", "type": "str"}, - } - - def __init__( - self, - *, - azure_async_operation: Optional[str] = None, - status: Optional[Union[str, "_models.OperationStatus"]] = None, - status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None, - request_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword azure_async_operation: Users can perform a Get on Azure-AsyncOperation to get the - status of their delete Zone operations. - :paramtype azure_async_operation: str - :keyword status: Known values are: "InProgress", "Succeeded", and "Failed". - :paramtype status: str or ~azure.mgmt.dns.v2016_04_01.models.OperationStatus - :keyword status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created", - "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", - "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", - "RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb", - "BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", - "NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", - "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", - "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", - "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", - "HttpVersionNotSupported", and "Continue". - :paramtype status_code: str or ~azure.mgmt.dns.v2016_04_01.models.HttpStatusCode - :keyword request_id: - :paramtype request_id: str - """ - super().__init__(**kwargs) - self.azure_async_operation = azure_async_operation - self.status = status - self.status_code = status_code - self.request_id = request_id - - -class ZoneListResult(_serialization.Model): - """The response to a Zone List or ListAll operation. - - :ivar value: Information about the DNS zones. - :vartype value: list[~azure.mgmt.dns.v2016_04_01.models.Zone] - :ivar next_link: The continuation token for the next page of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Zone]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Zone"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: Information about the DNS zones. - :paramtype value: list[~azure.mgmt.dns.v2016_04_01.models.Zone] - :keyword next_link: The continuation token for the next page of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/__init__.py deleted file mode 100644 index c12bcc6610ed..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/__init__.py +++ /dev/null @@ -1,21 +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 ._record_sets_operations import RecordSetsOperations -from ._zones_operations import ZonesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "RecordSetsOperations", - "ZonesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_record_sets_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_record_sets_operations.py deleted file mode 100644 index cdcff6e85244..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_record_sets_operations.py +++ /dev/null @@ -1,1040 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_update_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_type_request( - resource_group_name: str, - zone_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if recordsetnamesuffix is not None: - _params["$recordsetnamesuffix"] = _SERIALIZER.query("recordsetnamesuffix", recordsetnamesuffix, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_dns_zone_request( - resource_group_name: str, - zone_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if recordsetnamesuffix is not None: - _params["$recordsetnamesuffix"] = _SERIALIZER.query("recordsetnamesuffix", recordsetnamesuffix, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RecordSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2016_04_01.DnsManagementClient`'s - :attr:`record_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the Update operation. Is either a RecordSet type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a RecordSet - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - if_match: Optional[str] = None, - **kwargs: Any - ) -> None: - """Deletes a record set from a DNS zone. This operation cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA cannot - be deleted (they are deleted when the DNS zone is deleted). Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param if_match: The etag of the record set. Omit this value to always delete the current - record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent - changes. Default value is None. - :type if_match: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - **kwargs: Any - ) -> _models.RecordSet: - """Gets a record set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_type( - self, - resource_group_name: str, - zone_name: str, - record_type: Union[str, _models.RecordType], - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RecordSet"]: - """Lists the record sets of a specified type in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param record_type: The type of record sets to enumerate. Known values are: "A", "AAAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2016_04_01.models.RecordType - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2016_04_01.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_type_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_dns_zone( - self, - resource_group_name: str, - zone_name: str, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RecordSet"]: - """Lists all record sets in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2016_04_01.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_zones_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_zones_operations.py deleted file mode 100644 index e1fffbfaf77b..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/operations/_zones_operations.py +++ /dev/null @@ -1,730 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, - zone_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, zone_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, zone_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, *, top: Optional[int] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(subscription_id: str, *, top: Optional[int] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2016-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ZonesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2016_04_01.DnsManagementClient`'s - :attr:`zones` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: _models.Zone, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.Zone - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: Union[_models.Zone, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a Zone type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2016_04_01.models.Zone or IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Zone") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[_models.ZoneDeleteResult]: - """Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation - cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param if_match: The etag of the DNS zone. Omit this value to always delete the current zone. - Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. - Default value is None. - :type if_match: str - :return: An instance of LROPoller that returns either ZoneDeleteResult or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dns.v2016_04_01.models.ZoneDeleteResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.ZoneDeleteResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - zone_name=zone_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ZoneDeleteResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ZoneDeleteResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ZoneDeleteResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _models.Zone: - """Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2016_04_01.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.Zone"]: - """Lists the DNS zones within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2016_04_01.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Zone"]: - """Lists the DNS zones in all resource groups in a subscription. - - :param top: The maximum number of DNS zones to return. If not specified, returns up to 100 - zones. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2016_04_01.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2016-04-01")) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/py.typed b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2016_04_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/__init__.py deleted file mode 100644 index 23ee0cabde53..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/__init__.py +++ /dev/null @@ -1,26 +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 ._dns_management_client import DnsManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DnsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_configuration.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_configuration.py deleted file mode 100644 index 0ee3ba04e90b..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class DnsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for DnsManagementClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2018-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2018-03-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-dns/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_dns_management_client.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_dns_management_client.py deleted file mode 100644 index d3c8c270da50..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_dns_management_client.py +++ /dev/null @@ -1,119 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import DnsManagementClientConfiguration -from .operations import RecordSetsOperations, ZonesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class DnsManagementClient: # pylint: disable=client-accepts-api-version-keyword - """The DNS Management Client. - - :ivar record_sets: RecordSetsOperations operations - :vartype record_sets: azure.mgmt.dns.v2018_03_01_preview.operations.RecordSetsOperations - :ivar zones: ZonesOperations operations - :vartype zones: azure.mgmt.dns.v2018_03_01_preview.operations.ZonesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2018-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = DnsManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.record_sets = RecordSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-03-01-preview" - ) - self.zones = ZonesOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-03-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_metadata.json b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_metadata.json deleted file mode 100644 index c1d0f093ecc1..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_metadata.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "chosen_version": "2018-03-01-preview", - "total_api_version_list": ["2018-03-01-preview"], - "client": { - "name": "DnsManagementClient", - "filename": "_dns_management_client", - "description": "The DNS Management Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DnsManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DnsManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "record_sets": "RecordSetsOperations", - "zones": "ZonesOperations" - } -} diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_version.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_version.py deleted file mode 100644 index d5f3055d6eb4..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "8.2.0" diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/__init__.py deleted file mode 100644 index e94042023e78..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +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 ._dns_management_client import DnsManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DnsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_configuration.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_configuration.py deleted file mode 100644 index 7db23a1f5b77..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class DnsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for DnsManagementClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2018-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2018-03-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-dns/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_dns_management_client.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_dns_management_client.py deleted file mode 100644 index aa8dfb1337e0..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_dns_management_client.py +++ /dev/null @@ -1,121 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import DnsManagementClientConfiguration -from .operations import RecordSetsOperations, ZonesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class DnsManagementClient: # pylint: disable=client-accepts-api-version-keyword - """The DNS Management Client. - - :ivar record_sets: RecordSetsOperations operations - :vartype record_sets: azure.mgmt.dns.v2018_03_01_preview.aio.operations.RecordSetsOperations - :ivar zones: ZonesOperations operations - :vartype zones: azure.mgmt.dns.v2018_03_01_preview.aio.operations.ZonesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2018-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = DnsManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.record_sets = RecordSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-03-01-preview" - ) - self.zones = ZonesOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-03-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/__init__.py deleted file mode 100644 index c12bcc6610ed..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,21 +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 ._record_sets_operations import RecordSetsOperations -from ._zones_operations import ZonesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "RecordSetsOperations", - "ZonesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_record_sets_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_record_sets_operations.py deleted file mode 100644 index d525d769d56c..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_record_sets_operations.py +++ /dev/null @@ -1,883 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._record_sets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_all_by_dns_zone_request, - build_list_by_dns_zone_request, - build_list_by_type_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RecordSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2018_03_01_preview.aio.DnsManagementClient`'s - :attr:`record_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - async def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Is either a RecordSet type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a RecordSet - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - if_match: Optional[str] = None, - **kwargs: Any - ) -> None: - """Deletes a record set from a DNS zone. This operation cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA cannot - be deleted (they are deleted when the DNS zone is deleted). Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param if_match: The etag of the record set. Omit this value to always delete the current - record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent - changes. Default value is None. - :type if_match: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - **kwargs: Any - ) -> _models.RecordSet: - """Gets a record set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_type( - self, - resource_group_name: str, - zone_name: str, - record_type: Union[str, _models.RecordType], - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: - """Lists the record sets of a specified type in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param record_type: The type of record sets to enumerate. Known values are: "A", "AAAA", "CAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_type_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_dns_zone( - self, - resource_group_name: str, - zone_name: str, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: - """Lists all record sets in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_all_by_dns_zone( - self, - resource_group_name: str, - zone_name: str, - top: Optional[int] = None, - record_set_name_suffix: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: - """Lists all record sets in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param record_set_name_suffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type record_set_name_suffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - top=top, - record_set_name_suffix=record_set_name_suffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_zones_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_zones_operations.py deleted file mode 100644 index 5644b1d9eefb..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/aio/operations/_zones_operations.py +++ /dev/null @@ -1,720 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._zones_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ZonesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2018_03_01_preview.aio.DnsManagementClient`'s - :attr:`zones` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: _models.Zone, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: Union[_models.Zone, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a Zone type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone or IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Zone") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation - cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param if_match: The etag of the DNS zone. Omit this value to always delete the current zone. - Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. - Default value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - zone_name=zone_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _models.Zone: - """Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - zone_name: str, - parameters: _models.ZoneUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.ZoneUpdate - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - zone_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - zone_name: str, - parameters: Union[_models.ZoneUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Is either a ZoneUpdate type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.ZoneUpdate or IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ZoneUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.Zone"]: - """Lists the DNS zones within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2018_03_01_preview.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_models.Zone"]: - """Lists the DNS zones in all resource groups in a subscription. - - :param top: The maximum number of DNS zones to return. If not specified, returns up to 100 - zones. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2018_03_01_preview.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/__init__.py deleted file mode 100644 index c3693356ba8b..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import ARecord -from ._models_py3 import AaaaRecord -from ._models_py3 import CaaRecord -from ._models_py3 import CloudErrorBody -from ._models_py3 import CnameRecord -from ._models_py3 import MxRecord -from ._models_py3 import NsRecord -from ._models_py3 import PtrRecord -from ._models_py3 import RecordSet -from ._models_py3 import RecordSetListResult -from ._models_py3 import RecordSetUpdateParameters -from ._models_py3 import Resource -from ._models_py3 import SoaRecord -from ._models_py3 import SrvRecord -from ._models_py3 import SubResource -from ._models_py3 import TrackedResource -from ._models_py3 import TxtRecord -from ._models_py3 import Zone -from ._models_py3 import ZoneListResult -from ._models_py3 import ZoneUpdate - -from ._dns_management_client_enums import RecordType -from ._dns_management_client_enums import ZoneType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ARecord", - "AaaaRecord", - "CaaRecord", - "CloudErrorBody", - "CnameRecord", - "MxRecord", - "NsRecord", - "PtrRecord", - "RecordSet", - "RecordSetListResult", - "RecordSetUpdateParameters", - "Resource", - "SoaRecord", - "SrvRecord", - "SubResource", - "TrackedResource", - "TxtRecord", - "Zone", - "ZoneListResult", - "ZoneUpdate", - "RecordType", - "ZoneType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/_models_py3.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/_models_py3.py deleted file mode 100644 index 90f8bb6a739a..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/_models_py3.py +++ /dev/null @@ -1,816 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license 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, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AaaaRecord(_serialization.Model): - """An AAAA record. - - :ivar ipv6_address: The IPv6 address of this AAAA record. - :vartype ipv6_address: str - """ - - _attribute_map = { - "ipv6_address": {"key": "ipv6Address", "type": "str"}, - } - - def __init__(self, *, ipv6_address: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ipv6_address: The IPv6 address of this AAAA record. - :paramtype ipv6_address: str - """ - super().__init__(**kwargs) - self.ipv6_address = ipv6_address - - -class ARecord(_serialization.Model): - """An A record. - - :ivar ipv4_address: The IPv4 address of this A record. - :vartype ipv4_address: str - """ - - _attribute_map = { - "ipv4_address": {"key": "ipv4Address", "type": "str"}, - } - - def __init__(self, *, ipv4_address: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ipv4_address: The IPv4 address of this A record. - :paramtype ipv4_address: str - """ - super().__init__(**kwargs) - self.ipv4_address = ipv4_address - - -class CaaRecord(_serialization.Model): - """A CAA record. - - :ivar flags: The flags for this CAA record as an integer between 0 and 255. - :vartype flags: int - :ivar tag: The tag for this CAA record. - :vartype tag: str - :ivar value: The value for this CAA record. - :vartype value: str - """ - - _attribute_map = { - "flags": {"key": "flags", "type": "int"}, - "tag": {"key": "tag", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__( - self, *, flags: Optional[int] = None, tag: Optional[str] = None, value: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword flags: The flags for this CAA record as an integer between 0 and 255. - :paramtype flags: int - :keyword tag: The tag for this CAA record. - :paramtype tag: str - :keyword value: The value for this CAA record. - :paramtype value: str - """ - super().__init__(**kwargs) - self.flags = flags - self.tag = tag - self.value = value - - -class CloudErrorBody(_serialization.Model): - """An error response from the service. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.dns.v2018_03_01_preview.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.dns.v2018_03_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class CnameRecord(_serialization.Model): - """A CNAME record. - - :ivar cname: The canonical name for this CNAME record. - :vartype cname: str - """ - - _attribute_map = { - "cname": {"key": "cname", "type": "str"}, - } - - def __init__(self, *, cname: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword cname: The canonical name for this CNAME record. - :paramtype cname: str - """ - super().__init__(**kwargs) - self.cname = cname - - -class MxRecord(_serialization.Model): - """An MX record. - - :ivar preference: The preference value for this MX record. - :vartype preference: int - :ivar exchange: The domain name of the mail host for this MX record. - :vartype exchange: str - """ - - _attribute_map = { - "preference": {"key": "preference", "type": "int"}, - "exchange": {"key": "exchange", "type": "str"}, - } - - def __init__(self, *, preference: Optional[int] = None, exchange: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword preference: The preference value for this MX record. - :paramtype preference: int - :keyword exchange: The domain name of the mail host for this MX record. - :paramtype exchange: str - """ - super().__init__(**kwargs) - self.preference = preference - self.exchange = exchange - - -class NsRecord(_serialization.Model): - """An NS record. - - :ivar nsdname: The name server name for this NS record. - :vartype nsdname: str - """ - - _attribute_map = { - "nsdname": {"key": "nsdname", "type": "str"}, - } - - def __init__(self, *, nsdname: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword nsdname: The name server name for this NS record. - :paramtype nsdname: str - """ - super().__init__(**kwargs) - self.nsdname = nsdname - - -class PtrRecord(_serialization.Model): - """A PTR record. - - :ivar ptrdname: The PTR target domain name for this PTR record. - :vartype ptrdname: str - """ - - _attribute_map = { - "ptrdname": {"key": "ptrdname", "type": "str"}, - } - - def __init__(self, *, ptrdname: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ptrdname: The PTR target domain name for this PTR record. - :paramtype ptrdname: str - """ - super().__init__(**kwargs) - self.ptrdname = ptrdname - - -class RecordSet(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Describes a DNS record set (a collection of DNS records with the same name and type). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the record set. - :vartype id: str - :ivar name: The name of the record set. - :vartype name: str - :ivar type: The type of the record set. - :vartype type: str - :ivar etag: The etag of the record set. - :vartype etag: str - :ivar metadata: The metadata attached to the record set. - :vartype metadata: dict[str, str] - :ivar ttl: The TTL (time-to-live) of the records in the record set. - :vartype ttl: int - :ivar fqdn: Fully qualified domain name of the record set. - :vartype fqdn: str - :ivar a_records: The list of A records in the record set. - :vartype a_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.ARecord] - :ivar aaaa_records: The list of AAAA records in the record set. - :vartype aaaa_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.AaaaRecord] - :ivar mx_records: The list of MX records in the record set. - :vartype mx_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.MxRecord] - :ivar ns_records: The list of NS records in the record set. - :vartype ns_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.NsRecord] - :ivar ptr_records: The list of PTR records in the record set. - :vartype ptr_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.PtrRecord] - :ivar srv_records: The list of SRV records in the record set. - :vartype srv_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.SrvRecord] - :ivar txt_records: The list of TXT records in the record set. - :vartype txt_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.TxtRecord] - :ivar cname_record: The CNAME record in the record set. - :vartype cname_record: ~azure.mgmt.dns.v2018_03_01_preview.models.CnameRecord - :ivar soa_record: The SOA record in the record set. - :vartype soa_record: ~azure.mgmt.dns.v2018_03_01_preview.models.SoaRecord - :ivar caa_records: The list of CAA records in the record set. - :vartype caa_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.CaaRecord] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "fqdn": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "metadata": {"key": "properties.metadata", "type": "{str}"}, - "ttl": {"key": "properties.TTL", "type": "int"}, - "fqdn": {"key": "properties.fqdn", "type": "str"}, - "a_records": {"key": "properties.ARecords", "type": "[ARecord]"}, - "aaaa_records": {"key": "properties.AAAARecords", "type": "[AaaaRecord]"}, - "mx_records": {"key": "properties.MXRecords", "type": "[MxRecord]"}, - "ns_records": {"key": "properties.NSRecords", "type": "[NsRecord]"}, - "ptr_records": {"key": "properties.PTRRecords", "type": "[PtrRecord]"}, - "srv_records": {"key": "properties.SRVRecords", "type": "[SrvRecord]"}, - "txt_records": {"key": "properties.TXTRecords", "type": "[TxtRecord]"}, - "cname_record": {"key": "properties.CNAMERecord", "type": "CnameRecord"}, - "soa_record": {"key": "properties.SOARecord", "type": "SoaRecord"}, - "caa_records": {"key": "properties.caaRecords", "type": "[CaaRecord]"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - ttl: Optional[int] = None, - a_records: Optional[List["_models.ARecord"]] = None, - aaaa_records: Optional[List["_models.AaaaRecord"]] = None, - mx_records: Optional[List["_models.MxRecord"]] = None, - ns_records: Optional[List["_models.NsRecord"]] = None, - ptr_records: Optional[List["_models.PtrRecord"]] = None, - srv_records: Optional[List["_models.SrvRecord"]] = None, - txt_records: Optional[List["_models.TxtRecord"]] = None, - cname_record: Optional["_models.CnameRecord"] = None, - soa_record: Optional["_models.SoaRecord"] = None, - caa_records: Optional[List["_models.CaaRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword etag: The etag of the record set. - :paramtype etag: str - :keyword metadata: The metadata attached to the record set. - :paramtype metadata: dict[str, str] - :keyword ttl: The TTL (time-to-live) of the records in the record set. - :paramtype ttl: int - :keyword a_records: The list of A records in the record set. - :paramtype a_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.ARecord] - :keyword aaaa_records: The list of AAAA records in the record set. - :paramtype aaaa_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.AaaaRecord] - :keyword mx_records: The list of MX records in the record set. - :paramtype mx_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.MxRecord] - :keyword ns_records: The list of NS records in the record set. - :paramtype ns_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.NsRecord] - :keyword ptr_records: The list of PTR records in the record set. - :paramtype ptr_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.PtrRecord] - :keyword srv_records: The list of SRV records in the record set. - :paramtype srv_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.SrvRecord] - :keyword txt_records: The list of TXT records in the record set. - :paramtype txt_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.TxtRecord] - :keyword cname_record: The CNAME record in the record set. - :paramtype cname_record: ~azure.mgmt.dns.v2018_03_01_preview.models.CnameRecord - :keyword soa_record: The SOA record in the record set. - :paramtype soa_record: ~azure.mgmt.dns.v2018_03_01_preview.models.SoaRecord - :keyword caa_records: The list of CAA records in the record set. - :paramtype caa_records: list[~azure.mgmt.dns.v2018_03_01_preview.models.CaaRecord] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = etag - self.metadata = metadata - self.ttl = ttl - self.fqdn = None - self.a_records = a_records - self.aaaa_records = aaaa_records - self.mx_records = mx_records - self.ns_records = ns_records - self.ptr_records = ptr_records - self.srv_records = srv_records - self.txt_records = txt_records - self.cname_record = cname_record - self.soa_record = soa_record - self.caa_records = caa_records - - -class RecordSetListResult(_serialization.Model): - """The response to a record set List operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Information about the record sets in the response. - :vartype value: list[~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet] - :ivar next_link: The continuation token for the next page of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[RecordSet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.RecordSet"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Information about the record sets in the response. - :paramtype value: list[~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class RecordSetUpdateParameters(_serialization.Model): - """Parameters supplied to update a record set. - - :ivar record_set: Specifies information about the record set being updated. - :vartype record_set: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - """ - - _attribute_map = { - "record_set": {"key": "RecordSet", "type": "RecordSet"}, - } - - def __init__(self, *, record_set: Optional["_models.RecordSet"] = None, **kwargs: Any) -> None: - """ - :keyword record_set: Specifies information about the record set being updated. - :paramtype record_set: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - """ - super().__init__(**kwargs) - self.record_set = record_set - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class SoaRecord(_serialization.Model): - """An SOA record. - - :ivar host: The domain name of the authoritative name server for this SOA record. - :vartype host: str - :ivar email: The email contact for this SOA record. - :vartype email: str - :ivar serial_number: The serial number for this SOA record. - :vartype serial_number: int - :ivar refresh_time: The refresh value for this SOA record. - :vartype refresh_time: int - :ivar retry_time: The retry time for this SOA record. - :vartype retry_time: int - :ivar expire_time: The expire time for this SOA record. - :vartype expire_time: int - :ivar minimum_ttl: The minimum value for this SOA record. By convention this is used to - determine the negative caching duration. - :vartype minimum_ttl: int - """ - - _attribute_map = { - "host": {"key": "host", "type": "str"}, - "email": {"key": "email", "type": "str"}, - "serial_number": {"key": "serialNumber", "type": "int"}, - "refresh_time": {"key": "refreshTime", "type": "int"}, - "retry_time": {"key": "retryTime", "type": "int"}, - "expire_time": {"key": "expireTime", "type": "int"}, - "minimum_ttl": {"key": "minimumTTL", "type": "int"}, - } - - def __init__( - self, - *, - host: Optional[str] = None, - email: Optional[str] = None, - serial_number: Optional[int] = None, - refresh_time: Optional[int] = None, - retry_time: Optional[int] = None, - expire_time: Optional[int] = None, - minimum_ttl: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword host: The domain name of the authoritative name server for this SOA record. - :paramtype host: str - :keyword email: The email contact for this SOA record. - :paramtype email: str - :keyword serial_number: The serial number for this SOA record. - :paramtype serial_number: int - :keyword refresh_time: The refresh value for this SOA record. - :paramtype refresh_time: int - :keyword retry_time: The retry time for this SOA record. - :paramtype retry_time: int - :keyword expire_time: The expire time for this SOA record. - :paramtype expire_time: int - :keyword minimum_ttl: The minimum value for this SOA record. By convention this is used to - determine the negative caching duration. - :paramtype minimum_ttl: int - """ - super().__init__(**kwargs) - self.host = host - self.email = email - self.serial_number = serial_number - self.refresh_time = refresh_time - self.retry_time = retry_time - self.expire_time = expire_time - self.minimum_ttl = minimum_ttl - - -class SrvRecord(_serialization.Model): - """An SRV record. - - :ivar priority: The priority value for this SRV record. - :vartype priority: int - :ivar weight: The weight value for this SRV record. - :vartype weight: int - :ivar port: The port value for this SRV record. - :vartype port: int - :ivar target: The target domain name for this SRV record. - :vartype target: str - """ - - _attribute_map = { - "priority": {"key": "priority", "type": "int"}, - "weight": {"key": "weight", "type": "int"}, - "port": {"key": "port", "type": "int"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__( - self, - *, - priority: Optional[int] = None, - weight: Optional[int] = None, - port: Optional[int] = None, - target: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword priority: The priority value for this SRV record. - :paramtype priority: int - :keyword weight: The weight value for this SRV record. - :paramtype weight: int - :keyword port: The port value for this SRV record. - :paramtype port: int - :keyword target: The target domain name for this SRV record. - :paramtype target: str - """ - super().__init__(**kwargs) - self.priority = priority - self.weight = weight - self.port = port - self.target = target - - -class SubResource(_serialization.Model): - """A reference to a another resource. - - :ivar id: Resource Id. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Resource Id. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class TxtRecord(_serialization.Model): - """A TXT record. - - :ivar value: The text value of this TXT record. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: The text value of this TXT record. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class Zone(TrackedResource): # pylint: disable=too-many-instance-attributes - """Describes a DNS zone. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar etag: The etag of the zone. - :vartype etag: str - :ivar max_number_of_record_sets: The maximum number of record sets that can be created in this - DNS zone. This is a read-only property and any attempt to set this value will be ignored. - :vartype max_number_of_record_sets: int - :ivar max_number_of_records_per_record_set: The maximum number of records per record set that - can be created in this DNS zone. This is a read-only property and any attempt to set this - value will be ignored. - :vartype max_number_of_records_per_record_set: int - :ivar number_of_record_sets: The current number of record sets in this DNS zone. This is a - read-only property and any attempt to set this value will be ignored. - :vartype number_of_record_sets: int - :ivar name_servers: The name servers for this DNS zone. This is a read-only property and any - attempt to set this value will be ignored. - :vartype name_servers: list[str] - :ivar zone_type: The type of this DNS zone (Public or Private). Known values are: "Public" and - "Private". - :vartype zone_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.ZoneType - :ivar registration_virtual_networks: A list of references to virtual networks that register - hostnames in this DNS zone. This is a only when ZoneType is Private. - :vartype registration_virtual_networks: - list[~azure.mgmt.dns.v2018_03_01_preview.models.SubResource] - :ivar resolution_virtual_networks: A list of references to virtual networks that resolve - records in this DNS zone. This is a only when ZoneType is Private. - :vartype resolution_virtual_networks: - list[~azure.mgmt.dns.v2018_03_01_preview.models.SubResource] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "max_number_of_record_sets": {"readonly": True}, - "max_number_of_records_per_record_set": {"readonly": True}, - "number_of_record_sets": {"readonly": True}, - "name_servers": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "max_number_of_record_sets": {"key": "properties.maxNumberOfRecordSets", "type": "int"}, - "max_number_of_records_per_record_set": {"key": "properties.maxNumberOfRecordsPerRecordSet", "type": "int"}, - "number_of_record_sets": {"key": "properties.numberOfRecordSets", "type": "int"}, - "name_servers": {"key": "properties.nameServers", "type": "[str]"}, - "zone_type": {"key": "properties.zoneType", "type": "str"}, - "registration_virtual_networks": {"key": "properties.registrationVirtualNetworks", "type": "[SubResource]"}, - "resolution_virtual_networks": {"key": "properties.resolutionVirtualNetworks", "type": "[SubResource]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - etag: Optional[str] = None, - zone_type: Union[str, "_models.ZoneType"] = "Public", - registration_virtual_networks: Optional[List["_models.SubResource"]] = None, - resolution_virtual_networks: Optional[List["_models.SubResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword etag: The etag of the zone. - :paramtype etag: str - :keyword zone_type: The type of this DNS zone (Public or Private). Known values are: "Public" - and "Private". - :paramtype zone_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.ZoneType - :keyword registration_virtual_networks: A list of references to virtual networks that register - hostnames in this DNS zone. This is a only when ZoneType is Private. - :paramtype registration_virtual_networks: - list[~azure.mgmt.dns.v2018_03_01_preview.models.SubResource] - :keyword resolution_virtual_networks: A list of references to virtual networks that resolve - records in this DNS zone. This is a only when ZoneType is Private. - :paramtype resolution_virtual_networks: - list[~azure.mgmt.dns.v2018_03_01_preview.models.SubResource] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag = etag - self.max_number_of_record_sets = None - self.max_number_of_records_per_record_set = None - self.number_of_record_sets = None - self.name_servers = None - self.zone_type = zone_type - self.registration_virtual_networks = registration_virtual_networks - self.resolution_virtual_networks = resolution_virtual_networks - - -class ZoneListResult(_serialization.Model): - """The response to a Zone List or ListAll operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Information about the DNS zones. - :vartype value: list[~azure.mgmt.dns.v2018_03_01_preview.models.Zone] - :ivar next_link: The continuation token for the next page of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Zone]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.Zone"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Information about the DNS zones. - :paramtype value: list[~azure.mgmt.dns.v2018_03_01_preview.models.Zone] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class ZoneUpdate(_serialization.Model): - """Describes a request to update a DNS zone. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/__init__.py deleted file mode 100644 index c12bcc6610ed..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/__init__.py +++ /dev/null @@ -1,21 +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 ._record_sets_operations import RecordSetsOperations -from ._zones_operations import ZonesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "RecordSetsOperations", - "ZonesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_record_sets_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_record_sets_operations.py deleted file mode 100644 index 7221b1078d2c..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_record_sets_operations.py +++ /dev/null @@ -1,1194 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_update_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_type_request( - resource_group_name: str, - zone_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if recordsetnamesuffix is not None: - _params["$recordsetnamesuffix"] = _SERIALIZER.query("recordsetnamesuffix", recordsetnamesuffix, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_dns_zone_request( - resource_group_name: str, - zone_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if recordsetnamesuffix is not None: - _params["$recordsetnamesuffix"] = _SERIALIZER.query("recordsetnamesuffix", recordsetnamesuffix, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_all_by_dns_zone_request( - resource_group_name: str, - zone_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - record_set_name_suffix: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/all", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if record_set_name_suffix is not None: - _params["$recordsetnamesuffix"] = _SERIALIZER.query("record_set_name_suffix", record_set_name_suffix, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RecordSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2018_03_01_preview.DnsManagementClient`'s - :attr:`record_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Is either a RecordSet type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA can be - updated but not created (they are created when the DNS zone is created). Known values are: "A", - "AAAA", "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a RecordSet - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - if_match: Optional[str] = None, - **kwargs: Any - ) -> None: - """Deletes a record set from a DNS zone. This operation cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Record sets of type SOA cannot - be deleted (they are deleted when the DNS zone is deleted). Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param if_match: The etag of the record set. Omit this value to always delete the current - record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent - changes. Default value is None. - :type if_match: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - **kwargs: Any - ) -> _models.RecordSet: - """Gets a record set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_type( - self, - resource_group_name: str, - zone_name: str, - record_type: Union[str, _models.RecordType], - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RecordSet"]: - """Lists the record sets of a specified type in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param record_type: The type of record sets to enumerate. Known values are: "A", "AAAA", "CAA", - "CNAME", "MX", "NS", "PTR", "SOA", "SRV", and "TXT". Required. - :type record_type: str or ~azure.mgmt.dns.v2018_03_01_preview.models.RecordType - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_type_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_dns_zone( - self, - resource_group_name: str, - zone_name: str, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RecordSet"]: - """Lists all record sets in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_all_by_dns_zone( - self, - resource_group_name: str, - zone_name: str, - top: Optional[int] = None, - record_set_name_suffix: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RecordSet"]: - """Lists all record sets in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param record_set_name_suffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type record_set_name_suffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2018_03_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - top=top, - record_set_name_suffix=record_set_name_suffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_zones_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_zones_operations.py deleted file mode 100644 index e50c4af0ccaa..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/operations/_zones_operations.py +++ /dev/null @@ -1,923 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, - zone_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, zone_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, zone_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, zone_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, *, top: Optional[int] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(subscription_id: str, *, top: Optional[int] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ZonesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2018_03_01_preview.DnsManagementClient`'s - :attr:`zones` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: _models.Zone, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: Union[_models.Zone, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a Zone type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone or IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Zone") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation - cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param if_match: The etag of the DNS zone. Omit this value to always delete the current zone. - Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. - Default value is None. - :type if_match: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - zone_name=zone_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _models.Zone: - """Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - zone_name: str, - parameters: _models.ZoneUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.ZoneUpdate - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - zone_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - zone_name: str, - parameters: Union[_models.ZoneUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Is either a ZoneUpdate type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2018_03_01_preview.models.ZoneUpdate or IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2018_03_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ZoneUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.Zone"]: - """Lists the DNS zones within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2018_03_01_preview.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Zone"]: - """Lists the DNS zones in all resource groups in a subscription. - - :param top: The maximum number of DNS zones to return. If not specified, returns up to 100 - zones. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2018_03_01_preview.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2018-03-01-preview") - ) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/py.typed b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_03_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/__init__.py deleted file mode 100644 index 23ee0cabde53..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/__init__.py +++ /dev/null @@ -1,26 +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 ._dns_management_client import DnsManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DnsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_configuration.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_configuration.py deleted file mode 100644 index 892078296a8b..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class DnsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for DnsManagementClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the - Microsoft Azure subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2018-05-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-dns/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_dns_management_client.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_dns_management_client.py deleted file mode 100644 index 33cc3cfcc708..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_dns_management_client.py +++ /dev/null @@ -1,124 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import DnsManagementClientConfiguration -from .operations import DnsResourceReferenceOperations, RecordSetsOperations, ZonesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class DnsManagementClient: # pylint: disable=client-accepts-api-version-keyword - """The DNS Management Client. - - :ivar record_sets: RecordSetsOperations operations - :vartype record_sets: azure.mgmt.dns.v2018_05_01.operations.RecordSetsOperations - :ivar zones: ZonesOperations operations - :vartype zones: azure.mgmt.dns.v2018_05_01.operations.ZonesOperations - :ivar dns_resource_reference: DnsResourceReferenceOperations operations - :vartype dns_resource_reference: - azure.mgmt.dns.v2018_05_01.operations.DnsResourceReferenceOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the - Microsoft Azure subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = DnsManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.record_sets = RecordSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-05-01" - ) - self.zones = ZonesOperations(self._client, self._config, self._serialize, self._deserialize, "2018-05-01") - self.dns_resource_reference = DnsResourceReferenceOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-05-01" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_metadata.json b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_metadata.json deleted file mode 100644 index e8b400087b5a..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_metadata.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "chosen_version": "2018-05-01", - "total_api_version_list": ["2018-05-01"], - "client": { - "name": "DnsManagementClient", - "filename": "_dns_management_client", - "description": "The DNS Management Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DnsManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DnsManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Specifies the Azure subscription ID, which uniquely identifies the Microsoft Azure subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "record_sets": "RecordSetsOperations", - "zones": "ZonesOperations", - "dns_resource_reference": "DnsResourceReferenceOperations" - } -} diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_version.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_version.py deleted file mode 100644 index d5f3055d6eb4..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "8.2.0" diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/__init__.py deleted file mode 100644 index e94042023e78..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/__init__.py +++ /dev/null @@ -1,23 +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 ._dns_management_client import DnsManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DnsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_configuration.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_configuration.py deleted file mode 100644 index 8c43d85999aa..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class DnsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for DnsManagementClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the - Microsoft Azure subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2018-05-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-dns/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_dns_management_client.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_dns_management_client.py deleted file mode 100644 index 334fc69c8804..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_dns_management_client.py +++ /dev/null @@ -1,126 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import DnsManagementClientConfiguration -from .operations import DnsResourceReferenceOperations, RecordSetsOperations, ZonesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class DnsManagementClient: # pylint: disable=client-accepts-api-version-keyword - """The DNS Management Client. - - :ivar record_sets: RecordSetsOperations operations - :vartype record_sets: azure.mgmt.dns.v2018_05_01.aio.operations.RecordSetsOperations - :ivar zones: ZonesOperations operations - :vartype zones: azure.mgmt.dns.v2018_05_01.aio.operations.ZonesOperations - :ivar dns_resource_reference: DnsResourceReferenceOperations operations - :vartype dns_resource_reference: - azure.mgmt.dns.v2018_05_01.aio.operations.DnsResourceReferenceOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Specifies the Azure subscription ID, which uniquely identifies the - Microsoft Azure subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = DnsManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.record_sets = RecordSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-05-01" - ) - self.zones = ZonesOperations(self._client, self._config, self._serialize, self._deserialize, "2018-05-01") - self.dns_resource_reference = DnsResourceReferenceOperations( - self._client, self._config, self._serialize, self._deserialize, "2018-05-01" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/__init__.py deleted file mode 100644 index 1182e1bcbf84..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/__init__.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import ARecord -from ._models_py3 import AaaaRecord -from ._models_py3 import CaaRecord -from ._models_py3 import CloudErrorBody -from ._models_py3 import CnameRecord -from ._models_py3 import DnsResourceReference -from ._models_py3 import DnsResourceReferenceRequest -from ._models_py3 import DnsResourceReferenceResult -from ._models_py3 import MxRecord -from ._models_py3 import NsRecord -from ._models_py3 import PtrRecord -from ._models_py3 import RecordSet -from ._models_py3 import RecordSetListResult -from ._models_py3 import RecordSetUpdateParameters -from ._models_py3 import Resource -from ._models_py3 import SoaRecord -from ._models_py3 import SrvRecord -from ._models_py3 import SubResource -from ._models_py3 import TxtRecord -from ._models_py3 import Zone -from ._models_py3 import ZoneListResult -from ._models_py3 import ZoneUpdate - -from ._dns_management_client_enums import RecordType -from ._dns_management_client_enums import ZoneType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ARecord", - "AaaaRecord", - "CaaRecord", - "CloudErrorBody", - "CnameRecord", - "DnsResourceReference", - "DnsResourceReferenceRequest", - "DnsResourceReferenceResult", - "MxRecord", - "NsRecord", - "PtrRecord", - "RecordSet", - "RecordSetListResult", - "RecordSetUpdateParameters", - "Resource", - "SoaRecord", - "SrvRecord", - "SubResource", - "TxtRecord", - "Zone", - "ZoneListResult", - "ZoneUpdate", - "RecordType", - "ZoneType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_dns_management_client_enums.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_dns_management_client_enums.py deleted file mode 100644 index ca561301a0f6..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_dns_management_client_enums.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class RecordType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RecordType.""" - - A = "A" - AAAA = "AAAA" - CAA = "CAA" - CNAME = "CNAME" - MX = "MX" - NS = "NS" - PTR = "PTR" - SOA = "SOA" - SRV = "SRV" - TXT = "TXT" - - -class ZoneType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of this DNS zone (Public or Private).""" - - PUBLIC = "Public" - PRIVATE = "Private" diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/py.typed b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2018_05_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/__init__.py deleted file mode 100644 index 23ee0cabde53..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/__init__.py +++ /dev/null @@ -1,26 +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 ._dns_management_client import DnsManagementClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DnsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_configuration.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_configuration.py deleted file mode 100644 index 15867643e04d..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class DnsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for DnsManagementClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-07-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-dns/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_dns_management_client.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_dns_management_client.py deleted file mode 100644 index 836ed00bb9f7..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_dns_management_client.py +++ /dev/null @@ -1,130 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import DnsManagementClientConfiguration -from .operations import DnsResourceReferenceOperations, DnssecConfigsOperations, RecordSetsOperations, ZonesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class DnsManagementClient: # pylint: disable=client-accepts-api-version-keyword - """The DNS Management Client. - - :ivar dnssec_configs: DnssecConfigsOperations operations - :vartype dnssec_configs: azure.mgmt.dns.v2023_07_01_preview.operations.DnssecConfigsOperations - :ivar record_sets: RecordSetsOperations operations - :vartype record_sets: azure.mgmt.dns.v2023_07_01_preview.operations.RecordSetsOperations - :ivar zones: ZonesOperations operations - :vartype zones: azure.mgmt.dns.v2023_07_01_preview.operations.ZonesOperations - :ivar dns_resource_reference: DnsResourceReferenceOperations operations - :vartype dns_resource_reference: - azure.mgmt.dns.v2023_07_01_preview.operations.DnsResourceReferenceOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = DnsManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.dnssec_configs = DnssecConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.record_sets = RecordSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.zones = ZonesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.dns_resource_reference = DnsResourceReferenceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_metadata.json b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_metadata.json deleted file mode 100644 index f836b9545a19..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_metadata.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "chosen_version": "2023-07-01-preview", - "total_api_version_list": ["2023-07-01-preview"], - "client": { - "name": "DnsManagementClient", - "filename": "_dns_management_client", - "description": "The DNS Management Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DnsManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DnsManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "dnssec_configs": "DnssecConfigsOperations", - "record_sets": "RecordSetsOperations", - "zones": "ZonesOperations", - "dns_resource_reference": "DnsResourceReferenceOperations" - } -} diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_version.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_version.py deleted file mode 100644 index d5f3055d6eb4..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "8.2.0" diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/__init__.py deleted file mode 100644 index e94042023e78..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/__init__.py +++ /dev/null @@ -1,23 +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 ._dns_management_client import DnsManagementClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DnsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_configuration.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_configuration.py deleted file mode 100644 index 45362b825b12..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class DnsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for DnsManagementClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-07-01-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-dns/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_dns_management_client.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_dns_management_client.py deleted file mode 100644 index 309c458b9de8..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_dns_management_client.py +++ /dev/null @@ -1,133 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import DnsManagementClientConfiguration -from .operations import DnsResourceReferenceOperations, DnssecConfigsOperations, RecordSetsOperations, ZonesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class DnsManagementClient: # pylint: disable=client-accepts-api-version-keyword - """The DNS Management Client. - - :ivar dnssec_configs: DnssecConfigsOperations operations - :vartype dnssec_configs: - azure.mgmt.dns.v2023_07_01_preview.aio.operations.DnssecConfigsOperations - :ivar record_sets: RecordSetsOperations operations - :vartype record_sets: azure.mgmt.dns.v2023_07_01_preview.aio.operations.RecordSetsOperations - :ivar zones: ZonesOperations operations - :vartype zones: azure.mgmt.dns.v2023_07_01_preview.aio.operations.ZonesOperations - :ivar dns_resource_reference: DnsResourceReferenceOperations operations - :vartype dns_resource_reference: - azure.mgmt.dns.v2023_07_01_preview.aio.operations.DnsResourceReferenceOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-07-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = DnsManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.dnssec_configs = DnssecConfigsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.record_sets = RecordSetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.zones = ZonesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - self.dns_resource_reference = DnsResourceReferenceOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-07-01-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/__init__.py deleted file mode 100644 index 62aaadd3c149..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,25 +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 ._dnssec_configs_operations import DnssecConfigsOperations -from ._record_sets_operations import RecordSetsOperations -from ._zones_operations import ZonesOperations -from ._dns_resource_reference_operations import DnsResourceReferenceOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DnssecConfigsOperations", - "RecordSetsOperations", - "ZonesOperations", - "DnsResourceReferenceOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_dns_resource_reference_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_dns_resource_reference_operations.py deleted file mode 100644 index edea9ce03414..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_dns_resource_reference_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._dns_resource_reference_operations import build_get_by_target_resources_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DnsResourceReferenceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2023_07_01_preview.aio.DnsManagementClient`'s - :attr:`dns_resource_reference` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - async def get_by_target_resources( - self, parameters: _models.DnsResourceReferenceRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DnsResourceReferenceResult: - """Returns the DNS records specified by the referencing targetResourceIds. - - :param parameters: Properties for dns resource reference request. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReferenceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReferenceResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def get_by_target_resources( - self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DnsResourceReferenceResult: - """Returns the DNS records specified by the referencing targetResourceIds. - - :param parameters: Properties for dns resource reference request. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReferenceResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def get_by_target_resources( - self, parameters: Union[_models.DnsResourceReferenceRequest, IO[bytes]], **kwargs: Any - ) -> _models.DnsResourceReferenceResult: - """Returns the DNS records specified by the referencing targetResourceIds. - - :param parameters: Properties for dns resource reference request. Is either a - DnsResourceReferenceRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReferenceRequest or - IO[bytes] - :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReferenceResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DnsResourceReferenceResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DnsResourceReferenceRequest") - - _request = build_get_by_target_resources_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DnsResourceReferenceResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_dnssec_configs_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_dnssec_configs_operations.py deleted file mode 100644 index d3f682cd89cb..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_dnssec_configs_operations.py +++ /dev/null @@ -1,466 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._dnssec_configs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_dns_zone_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DnssecConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2023_07_01_preview.aio.DnsManagementClient`'s - :attr:`dnssec_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - async def _create_or_update_initial( - self, - resource_group_name: str, - zone_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - zone_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.DnssecConfig]: - """Creates or updates the DNSSEC configuration on a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param if_match: The etag of the DNSSEC configuration. Omit this value to always overwrite the - DNSSEC configuration. Specify the last-seen etag value to prevent accidentally overwriting any - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow this DNSSEC configuration to be created, but to - prevent updating existing DNSSEC configuration. Other values will be ignored. Default value is - None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either DnssecConfig or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.dns.v2023_07_01_preview.models.DnssecConfig] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DnssecConfig] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - zone_name=zone_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DnssecConfig", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DnssecConfig].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DnssecConfig]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes the DNSSEC configuration on a DNS zone. This operation cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param if_match: The etag of this DNSSEC configuration. Omit this value to always delete the - DNSSEC configuration. Specify the last-seen etag value to prevent accidentally deleting any - concurrent changes. Default value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - zone_name=zone_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _models.DnssecConfig: - """Gets the DNSSEC configuration. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :return: DnssecConfig or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.DnssecConfig - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DnssecConfig] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DnssecConfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_dns_zone( - self, resource_group_name: str, zone_name: str, **kwargs: Any - ) -> AsyncIterable["_models.DnssecConfig"]: - """Lists the DNSSEC configurations in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :return: An iterator like instance of either DnssecConfig or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.DnssecConfig] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DnssecConfigListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DnssecConfigListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_record_sets_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_record_sets_operations.py deleted file mode 100644 index d2a269ec3b99..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_record_sets_operations.py +++ /dev/null @@ -1,883 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._record_sets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_all_by_dns_zone_request, - build_list_by_dns_zone_request, - build_list_by_type_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class RecordSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2023_07_01_preview.aio.DnsManagementClient`'s - :attr:`record_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - async def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Is either a RecordSet type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but - not created (they are created when the DNS zone is created). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but - not created (they are created when the DNS zone is created). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but - not created (they are created when the DNS zone is created). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a RecordSet - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - if_match: Optional[str] = None, - **kwargs: Any - ) -> None: - """Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA - cannot be deleted (they are deleted when the DNS zone is deleted). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param if_match: The etag of the record set. Omit this value to always delete the current - record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent - changes. Default value is None. - :type if_match: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - **kwargs: Any - ) -> _models.RecordSet: - """Gets a record set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_type( - self, - resource_group_name: str, - zone_name: str, - record_type: Union[str, _models.RecordType], - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: - """Lists the record sets of a specified type in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_type_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_dns_zone( - self, - resource_group_name: str, - zone_name: str, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: - """Lists all record sets in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_all_by_dns_zone( - self, - resource_group_name: str, - zone_name: str, - top: Optional[int] = None, - record_set_name_suffix: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterable["_models.RecordSet"]: - """Lists all record sets in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param record_set_name_suffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type record_set_name_suffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - top=top, - record_set_name_suffix=record_set_name_suffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_zones_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_zones_operations.py deleted file mode 100644 index b081a4f710ca..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/aio/operations/_zones_operations.py +++ /dev/null @@ -1,724 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._zones_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ZonesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2023_07_01_preview.aio.DnsManagementClient`'s - :attr:`zones` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: _models.Zone, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: Union[_models.Zone, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a Zone type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone or IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Zone") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation - cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param if_match: The etag of the DNS zone. Omit this value to always delete the current zone. - Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. - Default value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - zone_name=zone_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _models.Zone: - """Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - zone_name: str, - parameters: _models.ZoneUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.ZoneUpdate - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - zone_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - zone_name: str, - parameters: Union[_models.ZoneUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Is either a ZoneUpdate type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.ZoneUpdate or IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ZoneUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.Zone"]: - """Lists the DNS zones within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> AsyncIterable["_models.Zone"]: - """Lists the DNS zones in all resource groups in a subscription. - - :param top: The maximum number of DNS zones to return. If not specified, returns up to 100 - zones. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/__init__.py deleted file mode 100644 index 10608c93c697..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/__init__.py +++ /dev/null @@ -1,85 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import ARecord -from ._models_py3 import AaaaRecord -from ._models_py3 import CaaRecord -from ._models_py3 import CloudErrorBody -from ._models_py3 import CnameRecord -from ._models_py3 import DelegationSignerInfo -from ._models_py3 import Digest -from ._models_py3 import DnsResourceReference -from ._models_py3 import DnsResourceReferenceRequest -from ._models_py3 import DnsResourceReferenceResult -from ._models_py3 import DnssecConfig -from ._models_py3 import DnssecConfigListResult -from ._models_py3 import DsRecord -from ._models_py3 import MxRecord -from ._models_py3 import NaptrRecord -from ._models_py3 import NsRecord -from ._models_py3 import PtrRecord -from ._models_py3 import RecordSet -from ._models_py3 import RecordSetListResult -from ._models_py3 import RecordSetUpdateParameters -from ._models_py3 import Resource -from ._models_py3 import SigningKey -from ._models_py3 import SoaRecord -from ._models_py3 import SrvRecord -from ._models_py3 import SubResource -from ._models_py3 import SystemData -from ._models_py3 import TlsaRecord -from ._models_py3 import TxtRecord -from ._models_py3 import Zone -from ._models_py3 import ZoneListResult -from ._models_py3 import ZoneUpdate - -from ._dns_management_client_enums import CreatedByType -from ._dns_management_client_enums import RecordType -from ._dns_management_client_enums import ZoneType -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ARecord", - "AaaaRecord", - "CaaRecord", - "CloudErrorBody", - "CnameRecord", - "DelegationSignerInfo", - "Digest", - "DnsResourceReference", - "DnsResourceReferenceRequest", - "DnsResourceReferenceResult", - "DnssecConfig", - "DnssecConfigListResult", - "DsRecord", - "MxRecord", - "NaptrRecord", - "NsRecord", - "PtrRecord", - "RecordSet", - "RecordSetListResult", - "RecordSetUpdateParameters", - "Resource", - "SigningKey", - "SoaRecord", - "SrvRecord", - "SubResource", - "SystemData", - "TlsaRecord", - "TxtRecord", - "Zone", - "ZoneListResult", - "ZoneUpdate", - "CreatedByType", - "RecordType", - "ZoneType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_dns_management_client_enums.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_dns_management_client_enums.py deleted file mode 100644 index 5d083e0c6557..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_dns_management_client_enums.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class RecordType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """RecordType.""" - - A = "A" - AAAA = "AAAA" - CAA = "CAA" - CNAME = "CNAME" - MX = "MX" - NS = "NS" - PTR = "PTR" - SOA = "SOA" - SRV = "SRV" - TXT = "TXT" - TLSA = "TLSA" - DS = "DS" - NAPTR = "NAPTR" - - -class ZoneType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of this DNS zone (Public or Private).""" - - PUBLIC = "Public" - PRIVATE = "Private" diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_models_py3.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_models_py3.py deleted file mode 100644 index 87ea6110fa87..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_models_py3.py +++ /dev/null @@ -1,1372 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AaaaRecord(_serialization.Model): - """An AAAA record. - - :ivar ipv6_address: The IPv6 address of this AAAA record. - :vartype ipv6_address: str - """ - - _attribute_map = { - "ipv6_address": {"key": "ipv6Address", "type": "str"}, - } - - def __init__(self, *, ipv6_address: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ipv6_address: The IPv6 address of this AAAA record. - :paramtype ipv6_address: str - """ - super().__init__(**kwargs) - self.ipv6_address = ipv6_address - - -class ARecord(_serialization.Model): - """An A record. - - :ivar ipv4_address: The IPv4 address of this A record. - :vartype ipv4_address: str - """ - - _attribute_map = { - "ipv4_address": {"key": "ipv4Address", "type": "str"}, - } - - def __init__(self, *, ipv4_address: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ipv4_address: The IPv4 address of this A record. - :paramtype ipv4_address: str - """ - super().__init__(**kwargs) - self.ipv4_address = ipv4_address - - -class CaaRecord(_serialization.Model): - """A CAA record. - - :ivar flags: The flags for this CAA record as an integer between 0 and 255. - :vartype flags: int - :ivar tag: The tag for this CAA record. - :vartype tag: str - :ivar value: The value for this CAA record. - :vartype value: str - """ - - _attribute_map = { - "flags": {"key": "flags", "type": "int"}, - "tag": {"key": "tag", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__( - self, *, flags: Optional[int] = None, tag: Optional[str] = None, value: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword flags: The flags for this CAA record as an integer between 0 and 255. - :paramtype flags: int - :keyword tag: The tag for this CAA record. - :paramtype tag: str - :keyword value: The value for this CAA record. - :paramtype value: str - """ - super().__init__(**kwargs) - self.flags = flags - self.tag = tag - self.value = value - - -class CloudErrorBody(_serialization.Model): - """An error response from the service. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.dns.v2023_07_01_preview.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.dns.v2023_07_01_preview.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class CnameRecord(_serialization.Model): - """A CNAME record. - - :ivar cname: The canonical name for this CNAME record. - :vartype cname: str - """ - - _attribute_map = { - "cname": {"key": "cname", "type": "str"}, - } - - def __init__(self, *, cname: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword cname: The canonical name for this CNAME record. - :paramtype cname: str - """ - super().__init__(**kwargs) - self.cname = cname - - -class DelegationSignerInfo(_serialization.Model): - """The delegation signer information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar digest_algorithm_type: The digest algorithm type represents the standard digest algorithm - number used to construct the digest. See: - https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml. - :vartype digest_algorithm_type: int - :ivar digest_value: The digest value is a cryptographic hash value of the referenced DNSKEY - Resource Record. - :vartype digest_value: str - :ivar record: The record represents a delegation signer (DS) record. - :vartype record: str - """ - - _validation = { - "digest_algorithm_type": {"readonly": True}, - "digest_value": {"readonly": True}, - "record": {"readonly": True}, - } - - _attribute_map = { - "digest_algorithm_type": {"key": "digestAlgorithmType", "type": "int"}, - "digest_value": {"key": "digestValue", "type": "str"}, - "record": {"key": "record", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.digest_algorithm_type = None - self.digest_value = None - self.record = None - - -class Digest(_serialization.Model): - """A digest. - - :ivar algorithm_type: The digest algorithm type represents the standard digest algorithm number - used to construct the digest. See: - https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml. - :vartype algorithm_type: int - :ivar value: The digest value is a cryptographic hash value of the referenced DNSKEY Resource - Record. - :vartype value: str - """ - - _attribute_map = { - "algorithm_type": {"key": "algorithmType", "type": "int"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, algorithm_type: Optional[int] = None, value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword algorithm_type: The digest algorithm type represents the standard digest algorithm - number used to construct the digest. See: - https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml. - :paramtype algorithm_type: int - :keyword value: The digest value is a cryptographic hash value of the referenced DNSKEY - Resource Record. - :paramtype value: str - """ - super().__init__(**kwargs) - self.algorithm_type = algorithm_type - self.value = value - - -class DnsResourceReference(_serialization.Model): - """Represents a single Azure resource and its referencing DNS records. - - :ivar dns_resources: A list of dns Records. - :vartype dns_resources: list[~azure.mgmt.dns.v2023_07_01_preview.models.SubResource] - :ivar target_resource: A reference to an azure resource from where the dns resource value is - taken. - :vartype target_resource: ~azure.mgmt.dns.v2023_07_01_preview.models.SubResource - """ - - _attribute_map = { - "dns_resources": {"key": "dnsResources", "type": "[SubResource]"}, - "target_resource": {"key": "targetResource", "type": "SubResource"}, - } - - def __init__( - self, - *, - dns_resources: Optional[List["_models.SubResource"]] = None, - target_resource: Optional["_models.SubResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword dns_resources: A list of dns Records. - :paramtype dns_resources: list[~azure.mgmt.dns.v2023_07_01_preview.models.SubResource] - :keyword target_resource: A reference to an azure resource from where the dns resource value is - taken. - :paramtype target_resource: ~azure.mgmt.dns.v2023_07_01_preview.models.SubResource - """ - super().__init__(**kwargs) - self.dns_resources = dns_resources - self.target_resource = target_resource - - -class DnsResourceReferenceRequest(_serialization.Model): - """Represents the properties of the Dns Resource Reference Request. - - :ivar target_resources: A list of references to azure resources for which referencing dns - records need to be queried. - :vartype target_resources: list[~azure.mgmt.dns.v2023_07_01_preview.models.SubResource] - """ - - _attribute_map = { - "target_resources": {"key": "properties.targetResources", "type": "[SubResource]"}, - } - - def __init__(self, *, target_resources: Optional[List["_models.SubResource"]] = None, **kwargs: Any) -> None: - """ - :keyword target_resources: A list of references to azure resources for which referencing dns - records need to be queried. - :paramtype target_resources: list[~azure.mgmt.dns.v2023_07_01_preview.models.SubResource] - """ - super().__init__(**kwargs) - self.target_resources = target_resources - - -class DnsResourceReferenceResult(_serialization.Model): - """Represents the properties of the Dns Resource Reference Result. - - :ivar dns_resource_references: The result of dns resource reference request. A list of dns - resource references for each of the azure resource in the request. - :vartype dns_resource_references: - list[~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReference] - """ - - _attribute_map = { - "dns_resource_references": {"key": "properties.dnsResourceReferences", "type": "[DnsResourceReference]"}, - } - - def __init__( - self, *, dns_resource_references: Optional[List["_models.DnsResourceReference"]] = None, **kwargs: Any - ) -> None: - """ - :keyword dns_resource_references: The result of dns resource reference request. A list of dns - resource references for each of the azure resource in the request. - :paramtype dns_resource_references: - list[~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReference] - """ - super().__init__(**kwargs) - self.dns_resource_references = dns_resource_references - - -class DnssecConfig(_serialization.Model): - """Represents the DNSSEC configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the DNSSEC configuration. - :vartype id: str - :ivar name: The name of the DNSSEC configuration. - :vartype name: str - :ivar type: The type of the DNSSEC configuration. - :vartype type: str - :ivar etag: The etag of the DNSSEC configuration. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dns.v2023_07_01_preview.models.SystemData - :ivar provisioning_state: Provisioning State of the DNSSEC configuration. - :vartype provisioning_state: str - :ivar signing_keys: The list of signing keys. - :vartype signing_keys: list[~azure.mgmt.dns.v2023_07_01_preview.models.SigningKey] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "signing_keys": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "signing_keys": {"key": "properties.signingKeys", "type": "[SigningKey]"}, - } - - def __init__(self, *, etag: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword etag: The etag of the DNSSEC configuration. - :paramtype etag: str - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = etag - self.system_data = None - self.provisioning_state = None - self.signing_keys = None - - -class DnssecConfigListResult(_serialization.Model): - """The response to a List DNSSEC configurations operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Information about the DNSSEC configurations in the response. - :vartype value: list[~azure.mgmt.dns.v2023_07_01_preview.models.DnssecConfig] - :ivar next_link: The continuation token for the next page of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[DnssecConfig]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.DnssecConfig"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Information about the DNSSEC configurations in the response. - :paramtype value: list[~azure.mgmt.dns.v2023_07_01_preview.models.DnssecConfig] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class DsRecord(_serialization.Model): - """A DS record. For more information about the DS record format, see RFC 4034: - https://www.rfc-editor.org/rfc/rfc4034. - - :ivar key_tag: The key tag value is used to determine which DNSKEY Resource Record is used for - signature verification. - :vartype key_tag: int - :ivar algorithm: The security algorithm type represents the standard security algorithm number - of the DNSKEY Resource Record. See: - https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml. - :vartype algorithm: int - :ivar digest: The digest entity. - :vartype digest: ~azure.mgmt.dns.v2023_07_01_preview.models.Digest - """ - - _attribute_map = { - "key_tag": {"key": "keyTag", "type": "int"}, - "algorithm": {"key": "algorithm", "type": "int"}, - "digest": {"key": "digest", "type": "Digest"}, - } - - def __init__( - self, - *, - key_tag: Optional[int] = None, - algorithm: Optional[int] = None, - digest: Optional["_models.Digest"] = None, - **kwargs: Any - ) -> None: - """ - :keyword key_tag: The key tag value is used to determine which DNSKEY Resource Record is used - for signature verification. - :paramtype key_tag: int - :keyword algorithm: The security algorithm type represents the standard security algorithm - number of the DNSKEY Resource Record. See: - https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml. - :paramtype algorithm: int - :keyword digest: The digest entity. - :paramtype digest: ~azure.mgmt.dns.v2023_07_01_preview.models.Digest - """ - super().__init__(**kwargs) - self.key_tag = key_tag - self.algorithm = algorithm - self.digest = digest - - -class MxRecord(_serialization.Model): - """An MX record. - - :ivar preference: The preference value for this MX record. - :vartype preference: int - :ivar exchange: The domain name of the mail host for this MX record. - :vartype exchange: str - """ - - _attribute_map = { - "preference": {"key": "preference", "type": "int"}, - "exchange": {"key": "exchange", "type": "str"}, - } - - def __init__(self, *, preference: Optional[int] = None, exchange: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword preference: The preference value for this MX record. - :paramtype preference: int - :keyword exchange: The domain name of the mail host for this MX record. - :paramtype exchange: str - """ - super().__init__(**kwargs) - self.preference = preference - self.exchange = exchange - - -class NaptrRecord(_serialization.Model): - """A NAPTR record. For more information about the NAPTR record format, see RFC 3403: - https://www.rfc-editor.org/rfc/rfc3403. - - :ivar order: The order in which the NAPTR records MUST be processed in order to accurately - represent the ordered list of rules. The ordering is from lowest to highest. Valid values: - 0-65535. - :vartype order: int - :ivar preference: The preference specifies the order in which NAPTR records with equal 'order' - values should be processed, low numbers being processed before high numbers. Valid values: - 0-65535. - :vartype preference: int - :ivar flags: The flags specific to DDDS applications. Values currently defined in RFC 3404 are - uppercase and lowercase letters "A", "P", "S", and "U", and the empty string, "". Enclose Flags - in quotation marks. - :vartype flags: str - :ivar services: The services specific to DDDS applications. Enclose Services in quotation - marks. - :vartype services: str - :ivar regexp: The regular expression that the DDDS application uses to convert an input value - into an output value. For example: an IP phone system might use a regular expression to convert - a phone number that is entered by a user into a SIP URI. Enclose the regular expression in - quotation marks. Specify either a value for 'regexp' or a value for 'replacement'. - :vartype regexp: str - :ivar replacement: The replacement is a fully qualified domain name (FQDN) of the next domain - name that you want the DDDS application to submit a DNS query for. The DDDS application - replaces the input value with the value specified for replacement. Specify either a value for - 'regexp' or a value for 'replacement'. If you specify a value for 'regexp', specify a dot (.) - for 'replacement'. - :vartype replacement: str - """ - - _attribute_map = { - "order": {"key": "order", "type": "int"}, - "preference": {"key": "preference", "type": "int"}, - "flags": {"key": "flags", "type": "str"}, - "services": {"key": "services", "type": "str"}, - "regexp": {"key": "regexp", "type": "str"}, - "replacement": {"key": "replacement", "type": "str"}, - } - - def __init__( - self, - *, - order: Optional[int] = None, - preference: Optional[int] = None, - flags: Optional[str] = None, - services: Optional[str] = None, - regexp: Optional[str] = None, - replacement: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword order: The order in which the NAPTR records MUST be processed in order to accurately - represent the ordered list of rules. The ordering is from lowest to highest. Valid values: - 0-65535. - :paramtype order: int - :keyword preference: The preference specifies the order in which NAPTR records with equal - 'order' values should be processed, low numbers being processed before high numbers. Valid - values: 0-65535. - :paramtype preference: int - :keyword flags: The flags specific to DDDS applications. Values currently defined in RFC 3404 - are uppercase and lowercase letters "A", "P", "S", and "U", and the empty string, "". Enclose - Flags in quotation marks. - :paramtype flags: str - :keyword services: The services specific to DDDS applications. Enclose Services in quotation - marks. - :paramtype services: str - :keyword regexp: The regular expression that the DDDS application uses to convert an input - value into an output value. For example: an IP phone system might use a regular expression to - convert a phone number that is entered by a user into a SIP URI. Enclose the regular expression - in quotation marks. Specify either a value for 'regexp' or a value for 'replacement'. - :paramtype regexp: str - :keyword replacement: The replacement is a fully qualified domain name (FQDN) of the next - domain name that you want the DDDS application to submit a DNS query for. The DDDS application - replaces the input value with the value specified for replacement. Specify either a value for - 'regexp' or a value for 'replacement'. If you specify a value for 'regexp', specify a dot (.) - for 'replacement'. - :paramtype replacement: str - """ - super().__init__(**kwargs) - self.order = order - self.preference = preference - self.flags = flags - self.services = services - self.regexp = regexp - self.replacement = replacement - - -class NsRecord(_serialization.Model): - """An NS record. - - :ivar nsdname: The name server name for this NS record. - :vartype nsdname: str - """ - - _attribute_map = { - "nsdname": {"key": "nsdname", "type": "str"}, - } - - def __init__(self, *, nsdname: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword nsdname: The name server name for this NS record. - :paramtype nsdname: str - """ - super().__init__(**kwargs) - self.nsdname = nsdname - - -class PtrRecord(_serialization.Model): - """A PTR record. - - :ivar ptrdname: The PTR target domain name for this PTR record. - :vartype ptrdname: str - """ - - _attribute_map = { - "ptrdname": {"key": "ptrdname", "type": "str"}, - } - - def __init__(self, *, ptrdname: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword ptrdname: The PTR target domain name for this PTR record. - :paramtype ptrdname: str - """ - super().__init__(**kwargs) - self.ptrdname = ptrdname - - -class RecordSet(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Describes a DNS record set (a collection of DNS records with the same name and type). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the record set. - :vartype id: str - :ivar name: The name of the record set. - :vartype name: str - :ivar type: The type of the record set. - :vartype type: str - :ivar etag: The etag of the record set. - :vartype etag: str - :ivar metadata: The metadata attached to the record set. - :vartype metadata: dict[str, str] - :ivar ttl: The TTL (time-to-live) of the records in the record set. - :vartype ttl: int - :ivar fqdn: Fully qualified domain name of the record set. - :vartype fqdn: str - :ivar provisioning_state: provisioning State of the record set. - :vartype provisioning_state: str - :ivar target_resource: A reference to an azure resource from where the dns resource value is - taken. - :vartype target_resource: ~azure.mgmt.dns.v2023_07_01_preview.models.SubResource - :ivar traffic_management_profile: A reference to an azure traffic manager profile resource from - where the dns resource value is taken. - :vartype traffic_management_profile: ~azure.mgmt.dns.v2023_07_01_preview.models.SubResource - :ivar a_records: The list of A records in the record set. - :vartype a_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.ARecord] - :ivar aaaa_records: The list of AAAA records in the record set. - :vartype aaaa_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.AaaaRecord] - :ivar mx_records: The list of MX records in the record set. - :vartype mx_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.MxRecord] - :ivar ns_records: The list of NS records in the record set. - :vartype ns_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.NsRecord] - :ivar ptr_records: The list of PTR records in the record set. - :vartype ptr_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.PtrRecord] - :ivar srv_records: The list of SRV records in the record set. - :vartype srv_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.SrvRecord] - :ivar txt_records: The list of TXT records in the record set. - :vartype txt_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.TxtRecord] - :ivar cname_record: The CNAME record in the record set. - :vartype cname_record: ~azure.mgmt.dns.v2023_07_01_preview.models.CnameRecord - :ivar soa_record: The SOA record in the record set. - :vartype soa_record: ~azure.mgmt.dns.v2023_07_01_preview.models.SoaRecord - :ivar caa_records: The list of CAA records in the record set. - :vartype caa_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.CaaRecord] - :ivar ds_records: The list of DS records in the record set. - :vartype ds_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.DsRecord] - :ivar tlsa_records: The list of TLSA records in the record set. - :vartype tlsa_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.TlsaRecord] - :ivar naptr_records: The list of NAPTR records in the record set. - :vartype naptr_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.NaptrRecord] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "fqdn": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "metadata": {"key": "properties.metadata", "type": "{str}"}, - "ttl": {"key": "properties.TTL", "type": "int"}, - "fqdn": {"key": "properties.fqdn", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "target_resource": {"key": "properties.targetResource", "type": "SubResource"}, - "traffic_management_profile": {"key": "properties.trafficManagementProfile", "type": "SubResource"}, - "a_records": {"key": "properties.ARecords", "type": "[ARecord]"}, - "aaaa_records": {"key": "properties.AAAARecords", "type": "[AaaaRecord]"}, - "mx_records": {"key": "properties.MXRecords", "type": "[MxRecord]"}, - "ns_records": {"key": "properties.NSRecords", "type": "[NsRecord]"}, - "ptr_records": {"key": "properties.PTRRecords", "type": "[PtrRecord]"}, - "srv_records": {"key": "properties.SRVRecords", "type": "[SrvRecord]"}, - "txt_records": {"key": "properties.TXTRecords", "type": "[TxtRecord]"}, - "cname_record": {"key": "properties.CNAMERecord", "type": "CnameRecord"}, - "soa_record": {"key": "properties.SOARecord", "type": "SoaRecord"}, - "caa_records": {"key": "properties.caaRecords", "type": "[CaaRecord]"}, - "ds_records": {"key": "properties.DSRecords", "type": "[DsRecord]"}, - "tlsa_records": {"key": "properties.TLSARecords", "type": "[TlsaRecord]"}, - "naptr_records": {"key": "properties.NAPTRRecords", "type": "[NaptrRecord]"}, - } - - def __init__( - self, - *, - etag: Optional[str] = None, - metadata: Optional[Dict[str, str]] = None, - ttl: Optional[int] = None, - target_resource: Optional["_models.SubResource"] = None, - traffic_management_profile: Optional["_models.SubResource"] = None, - a_records: Optional[List["_models.ARecord"]] = None, - aaaa_records: Optional[List["_models.AaaaRecord"]] = None, - mx_records: Optional[List["_models.MxRecord"]] = None, - ns_records: Optional[List["_models.NsRecord"]] = None, - ptr_records: Optional[List["_models.PtrRecord"]] = None, - srv_records: Optional[List["_models.SrvRecord"]] = None, - txt_records: Optional[List["_models.TxtRecord"]] = None, - cname_record: Optional["_models.CnameRecord"] = None, - soa_record: Optional["_models.SoaRecord"] = None, - caa_records: Optional[List["_models.CaaRecord"]] = None, - ds_records: Optional[List["_models.DsRecord"]] = None, - tlsa_records: Optional[List["_models.TlsaRecord"]] = None, - naptr_records: Optional[List["_models.NaptrRecord"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword etag: The etag of the record set. - :paramtype etag: str - :keyword metadata: The metadata attached to the record set. - :paramtype metadata: dict[str, str] - :keyword ttl: The TTL (time-to-live) of the records in the record set. - :paramtype ttl: int - :keyword target_resource: A reference to an azure resource from where the dns resource value is - taken. - :paramtype target_resource: ~azure.mgmt.dns.v2023_07_01_preview.models.SubResource - :keyword traffic_management_profile: A reference to an azure traffic manager profile resource - from where the dns resource value is taken. - :paramtype traffic_management_profile: ~azure.mgmt.dns.v2023_07_01_preview.models.SubResource - :keyword a_records: The list of A records in the record set. - :paramtype a_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.ARecord] - :keyword aaaa_records: The list of AAAA records in the record set. - :paramtype aaaa_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.AaaaRecord] - :keyword mx_records: The list of MX records in the record set. - :paramtype mx_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.MxRecord] - :keyword ns_records: The list of NS records in the record set. - :paramtype ns_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.NsRecord] - :keyword ptr_records: The list of PTR records in the record set. - :paramtype ptr_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.PtrRecord] - :keyword srv_records: The list of SRV records in the record set. - :paramtype srv_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.SrvRecord] - :keyword txt_records: The list of TXT records in the record set. - :paramtype txt_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.TxtRecord] - :keyword cname_record: The CNAME record in the record set. - :paramtype cname_record: ~azure.mgmt.dns.v2023_07_01_preview.models.CnameRecord - :keyword soa_record: The SOA record in the record set. - :paramtype soa_record: ~azure.mgmt.dns.v2023_07_01_preview.models.SoaRecord - :keyword caa_records: The list of CAA records in the record set. - :paramtype caa_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.CaaRecord] - :keyword ds_records: The list of DS records in the record set. - :paramtype ds_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.DsRecord] - :keyword tlsa_records: The list of TLSA records in the record set. - :paramtype tlsa_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.TlsaRecord] - :keyword naptr_records: The list of NAPTR records in the record set. - :paramtype naptr_records: list[~azure.mgmt.dns.v2023_07_01_preview.models.NaptrRecord] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = etag - self.metadata = metadata - self.ttl = ttl - self.fqdn = None - self.provisioning_state = None - self.target_resource = target_resource - self.traffic_management_profile = traffic_management_profile - self.a_records = a_records - self.aaaa_records = aaaa_records - self.mx_records = mx_records - self.ns_records = ns_records - self.ptr_records = ptr_records - self.srv_records = srv_records - self.txt_records = txt_records - self.cname_record = cname_record - self.soa_record = soa_record - self.caa_records = caa_records - self.ds_records = ds_records - self.tlsa_records = tlsa_records - self.naptr_records = naptr_records - - -class RecordSetListResult(_serialization.Model): - """The response to a record set List operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Information about the record sets in the response. - :vartype value: list[~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet] - :ivar next_link: The continuation token for the next page of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[RecordSet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.RecordSet"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Information about the record sets in the response. - :paramtype value: list[~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class RecordSetUpdateParameters(_serialization.Model): - """Parameters supplied to update a record set. - - :ivar record_set: Specifies information about the record set being updated. - :vartype record_set: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - """ - - _attribute_map = { - "record_set": {"key": "RecordSet", "type": "RecordSet"}, - } - - def __init__(self, *, record_set: Optional["_models.RecordSet"] = None, **kwargs: Any) -> None: - """ - :keyword record_set: Specifies information about the record set being updated. - :paramtype record_set: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - """ - super().__init__(**kwargs) - self.record_set = record_set - - -class Resource(_serialization.Model): - """Common properties of an Azure Resource Manager resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - - -class SigningKey(_serialization.Model): - """Represents the signing key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar delegation_signer_info: The delegation signer information. - :vartype delegation_signer_info: - list[~azure.mgmt.dns.v2023_07_01_preview.models.DelegationSignerInfo] - :ivar flags: The flags specifies how the key is used. - :vartype flags: int - :ivar key_tag: The key tag value of the DNSKEY Resource Record. - :vartype key_tag: int - :ivar protocol: The protocol value. The value is always 3. - :vartype protocol: int - :ivar public_key: The public key, represented as a Base64 encoding. - :vartype public_key: str - :ivar security_algorithm_type: The security algorithm type represents the standard security - algorithm number of the DNSKEY Resource Record. See: - https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml. - :vartype security_algorithm_type: int - """ - - _validation = { - "delegation_signer_info": {"readonly": True}, - "flags": {"readonly": True}, - "key_tag": {"readonly": True}, - "protocol": {"readonly": True}, - "public_key": {"readonly": True}, - "security_algorithm_type": {"readonly": True}, - } - - _attribute_map = { - "delegation_signer_info": {"key": "delegationSignerInfo", "type": "[DelegationSignerInfo]"}, - "flags": {"key": "flags", "type": "int"}, - "key_tag": {"key": "keyTag", "type": "int"}, - "protocol": {"key": "protocol", "type": "int"}, - "public_key": {"key": "publicKey", "type": "str"}, - "security_algorithm_type": {"key": "securityAlgorithmType", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.delegation_signer_info = None - self.flags = None - self.key_tag = None - self.protocol = None - self.public_key = None - self.security_algorithm_type = None - - -class SoaRecord(_serialization.Model): - """An SOA record. - - :ivar host: The domain name of the authoritative name server for this SOA record. - :vartype host: str - :ivar email: The email contact for this SOA record. - :vartype email: str - :ivar serial_number: The serial number for this SOA record. - :vartype serial_number: int - :ivar refresh_time: The refresh value for this SOA record. - :vartype refresh_time: int - :ivar retry_time: The retry time for this SOA record. - :vartype retry_time: int - :ivar expire_time: The expire time for this SOA record. - :vartype expire_time: int - :ivar minimum_ttl: The minimum value for this SOA record. By convention this is used to - determine the negative caching duration. - :vartype minimum_ttl: int - """ - - _attribute_map = { - "host": {"key": "host", "type": "str"}, - "email": {"key": "email", "type": "str"}, - "serial_number": {"key": "serialNumber", "type": "int"}, - "refresh_time": {"key": "refreshTime", "type": "int"}, - "retry_time": {"key": "retryTime", "type": "int"}, - "expire_time": {"key": "expireTime", "type": "int"}, - "minimum_ttl": {"key": "minimumTTL", "type": "int"}, - } - - def __init__( - self, - *, - host: Optional[str] = None, - email: Optional[str] = None, - serial_number: Optional[int] = None, - refresh_time: Optional[int] = None, - retry_time: Optional[int] = None, - expire_time: Optional[int] = None, - minimum_ttl: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword host: The domain name of the authoritative name server for this SOA record. - :paramtype host: str - :keyword email: The email contact for this SOA record. - :paramtype email: str - :keyword serial_number: The serial number for this SOA record. - :paramtype serial_number: int - :keyword refresh_time: The refresh value for this SOA record. - :paramtype refresh_time: int - :keyword retry_time: The retry time for this SOA record. - :paramtype retry_time: int - :keyword expire_time: The expire time for this SOA record. - :paramtype expire_time: int - :keyword minimum_ttl: The minimum value for this SOA record. By convention this is used to - determine the negative caching duration. - :paramtype minimum_ttl: int - """ - super().__init__(**kwargs) - self.host = host - self.email = email - self.serial_number = serial_number - self.refresh_time = refresh_time - self.retry_time = retry_time - self.expire_time = expire_time - self.minimum_ttl = minimum_ttl - - -class SrvRecord(_serialization.Model): - """An SRV record. - - :ivar priority: The priority value for this SRV record. - :vartype priority: int - :ivar weight: The weight value for this SRV record. - :vartype weight: int - :ivar port: The port value for this SRV record. - :vartype port: int - :ivar target: The target domain name for this SRV record. - :vartype target: str - """ - - _attribute_map = { - "priority": {"key": "priority", "type": "int"}, - "weight": {"key": "weight", "type": "int"}, - "port": {"key": "port", "type": "int"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__( - self, - *, - priority: Optional[int] = None, - weight: Optional[int] = None, - port: Optional[int] = None, - target: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword priority: The priority value for this SRV record. - :paramtype priority: int - :keyword weight: The weight value for this SRV record. - :paramtype weight: int - :keyword port: The port value for this SRV record. - :paramtype port: int - :keyword target: The target domain name for this SRV record. - :paramtype target: str - """ - super().__init__(**kwargs) - self.priority = priority - self.weight = weight - self.port = port - self.target = target - - -class SubResource(_serialization.Model): - """A reference to a another resource. - - :ivar id: Resource Id. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: Resource Id. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.dns.v2023_07_01_preview.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TlsaRecord(_serialization.Model): - """A TLSA record. For more information about the TLSA record format, see RFC 6698: - https://www.rfc-editor.org/rfc/rfc6698. - - :ivar usage: The usage specifies the provided association that will be used to match the - certificate presented in the TLS handshake. - :vartype usage: int - :ivar selector: The selector specifies which part of the TLS certificate presented by the - server will be matched against the association data. - :vartype selector: int - :ivar matching_type: The matching type specifies how the certificate association is presented. - :vartype matching_type: int - :ivar cert_association_data: This specifies the certificate association data to be matched. - :vartype cert_association_data: str - """ - - _attribute_map = { - "usage": {"key": "usage", "type": "int"}, - "selector": {"key": "selector", "type": "int"}, - "matching_type": {"key": "matchingType", "type": "int"}, - "cert_association_data": {"key": "certAssociationData", "type": "str"}, - } - - def __init__( - self, - *, - usage: Optional[int] = None, - selector: Optional[int] = None, - matching_type: Optional[int] = None, - cert_association_data: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword usage: The usage specifies the provided association that will be used to match the - certificate presented in the TLS handshake. - :paramtype usage: int - :keyword selector: The selector specifies which part of the TLS certificate presented by the - server will be matched against the association data. - :paramtype selector: int - :keyword matching_type: The matching type specifies how the certificate association is - presented. - :paramtype matching_type: int - :keyword cert_association_data: This specifies the certificate association data to be matched. - :paramtype cert_association_data: str - """ - super().__init__(**kwargs) - self.usage = usage - self.selector = selector - self.matching_type = matching_type - self.cert_association_data = cert_association_data - - -class TxtRecord(_serialization.Model): - """A TXT record. - - :ivar value: The text value of this TXT record. - :vartype value: list[str] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[str]"}, - } - - def __init__(self, *, value: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword value: The text value of this TXT record. - :paramtype value: list[str] - """ - super().__init__(**kwargs) - self.value = value - - -class Zone(Resource): # pylint: disable=too-many-instance-attributes - """Describes a DNS zone. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Resource ID. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar etag: The etag of the zone. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dns.v2023_07_01_preview.models.SystemData - :ivar max_number_of_record_sets: The maximum number of record sets that can be created in this - DNS zone. This is a read-only property and any attempt to set this value will be ignored. - :vartype max_number_of_record_sets: int - :ivar max_number_of_records_per_record_set: The maximum number of records per record set that - can be created in this DNS zone. This is a read-only property and any attempt to set this - value will be ignored. - :vartype max_number_of_records_per_record_set: int - :ivar number_of_record_sets: The current number of record sets in this DNS zone. This is a - read-only property and any attempt to set this value will be ignored. - :vartype number_of_record_sets: int - :ivar name_servers: The name servers for this DNS zone. This is a read-only property and any - attempt to set this value will be ignored. - :vartype name_servers: list[str] - :ivar zone_type: The type of this DNS zone (Public or Private). Known values are: "Public" and - "Private". - :vartype zone_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.ZoneType - :ivar registration_virtual_networks: A list of references to virtual networks that register - hostnames in this DNS zone. This is a only when ZoneType is Private. - :vartype registration_virtual_networks: - list[~azure.mgmt.dns.v2023_07_01_preview.models.SubResource] - :ivar resolution_virtual_networks: A list of references to virtual networks that resolve - records in this DNS zone. This is a only when ZoneType is Private. - :vartype resolution_virtual_networks: - list[~azure.mgmt.dns.v2023_07_01_preview.models.SubResource] - :ivar signing_keys: The list of signing keys. - :vartype signing_keys: list[~azure.mgmt.dns.v2023_07_01_preview.models.SigningKey] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "max_number_of_record_sets": {"readonly": True}, - "max_number_of_records_per_record_set": {"readonly": True}, - "number_of_record_sets": {"readonly": True}, - "name_servers": {"readonly": True}, - "signing_keys": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "max_number_of_record_sets": {"key": "properties.maxNumberOfRecordSets", "type": "int"}, - "max_number_of_records_per_record_set": {"key": "properties.maxNumberOfRecordsPerRecordSet", "type": "int"}, - "number_of_record_sets": {"key": "properties.numberOfRecordSets", "type": "int"}, - "name_servers": {"key": "properties.nameServers", "type": "[str]"}, - "zone_type": {"key": "properties.zoneType", "type": "str"}, - "registration_virtual_networks": {"key": "properties.registrationVirtualNetworks", "type": "[SubResource]"}, - "resolution_virtual_networks": {"key": "properties.resolutionVirtualNetworks", "type": "[SubResource]"}, - "signing_keys": {"key": "properties.signingKeys", "type": "[SigningKey]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - etag: Optional[str] = None, - zone_type: Union[str, "_models.ZoneType"] = "Public", - registration_virtual_networks: Optional[List["_models.SubResource"]] = None, - resolution_virtual_networks: Optional[List["_models.SubResource"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword etag: The etag of the zone. - :paramtype etag: str - :keyword zone_type: The type of this DNS zone (Public or Private). Known values are: "Public" - and "Private". - :paramtype zone_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.ZoneType - :keyword registration_virtual_networks: A list of references to virtual networks that register - hostnames in this DNS zone. This is a only when ZoneType is Private. - :paramtype registration_virtual_networks: - list[~azure.mgmt.dns.v2023_07_01_preview.models.SubResource] - :keyword resolution_virtual_networks: A list of references to virtual networks that resolve - records in this DNS zone. This is a only when ZoneType is Private. - :paramtype resolution_virtual_networks: - list[~azure.mgmt.dns.v2023_07_01_preview.models.SubResource] - """ - super().__init__(location=location, tags=tags, **kwargs) - self.etag = etag - self.system_data = None - self.max_number_of_record_sets = None - self.max_number_of_records_per_record_set = None - self.number_of_record_sets = None - self.name_servers = None - self.zone_type = zone_type - self.registration_virtual_networks = registration_virtual_networks - self.resolution_virtual_networks = resolution_virtual_networks - self.signing_keys = None - - -class ZoneListResult(_serialization.Model): - """The response to a Zone List or ListAll operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Information about the DNS zones. - :vartype value: list[~azure.mgmt.dns.v2023_07_01_preview.models.Zone] - :ivar next_link: The continuation token for the next page of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Zone]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.Zone"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Information about the DNS zones. - :paramtype value: list[~azure.mgmt.dns.v2023_07_01_preview.models.Zone] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class ZoneUpdate(_serialization.Model): - """Describes a request to update a DNS zone. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/__init__.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/__init__.py deleted file mode 100644 index 62aaadd3c149..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/__init__.py +++ /dev/null @@ -1,25 +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 ._dnssec_configs_operations import DnssecConfigsOperations -from ._record_sets_operations import RecordSetsOperations -from ._zones_operations import ZonesOperations -from ._dns_resource_reference_operations import DnsResourceReferenceOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "DnssecConfigsOperations", - "RecordSetsOperations", - "ZonesOperations", - "DnsResourceReferenceOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_dns_resource_reference_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_dns_resource_reference_operations.py deleted file mode 100644 index 5e7472c19d46..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_dns_resource_reference_operations.py +++ /dev/null @@ -1,188 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_by_target_resources_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/getDnsResourceReference" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DnsResourceReferenceOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2023_07_01_preview.DnsManagementClient`'s - :attr:`dns_resource_reference` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - def get_by_target_resources( - self, parameters: _models.DnsResourceReferenceRequest, *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DnsResourceReferenceResult: - """Returns the DNS records specified by the referencing targetResourceIds. - - :param parameters: Properties for dns resource reference request. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReferenceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReferenceResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def get_by_target_resources( - self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.DnsResourceReferenceResult: - """Returns the DNS records specified by the referencing targetResourceIds. - - :param parameters: Properties for dns resource reference request. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReferenceResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def get_by_target_resources( - self, parameters: Union[_models.DnsResourceReferenceRequest, IO[bytes]], **kwargs: Any - ) -> _models.DnsResourceReferenceResult: - """Returns the DNS records specified by the referencing targetResourceIds. - - :param parameters: Properties for dns resource reference request. Is either a - DnsResourceReferenceRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReferenceRequest or - IO[bytes] - :return: DnsResourceReferenceResult or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.DnsResourceReferenceResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DnsResourceReferenceResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DnsResourceReferenceRequest") - - _request = build_get_by_target_resources_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DnsResourceReferenceResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_dnssec_configs_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_dnssec_configs_operations.py deleted file mode 100644 index 47f9033b8a82..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_dnssec_configs_operations.py +++ /dev/null @@ -1,603 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, - zone_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, zone_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, zone_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs/default", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_dns_zone_request( - resource_group_name: str, zone_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/dnssecConfigs", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class DnssecConfigsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2023_07_01_preview.DnsManagementClient`'s - :attr:`dnssec_configs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - def _create_or_update_initial( - self, - resource_group_name: str, - zone_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - zone_name: str, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.DnssecConfig]: - """Creates or updates the DNSSEC configuration on a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param if_match: The etag of the DNSSEC configuration. Omit this value to always overwrite the - DNSSEC configuration. Specify the last-seen etag value to prevent accidentally overwriting any - concurrent changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow this DNSSEC configuration to be created, but to - prevent updating existing DNSSEC configuration. Other values will be ignored. Default value is - None. - :type if_none_match: str - :return: An instance of LROPoller that returns either DnssecConfig or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dns.v2023_07_01_preview.models.DnssecConfig] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DnssecConfig] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - zone_name=zone_name, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DnssecConfig", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DnssecConfig].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DnssecConfig]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Deletes the DNSSEC configuration on a DNS zone. This operation cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param if_match: The etag of this DNSSEC configuration. Omit this value to always delete the - DNSSEC configuration. Specify the last-seen etag value to prevent accidentally deleting any - concurrent changes. Default value is None. - :type if_match: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - zone_name=zone_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _models.DnssecConfig: - """Gets the DNSSEC configuration. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :return: DnssecConfig or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.DnssecConfig - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DnssecConfig] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("DnssecConfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_dns_zone( - self, resource_group_name: str, zone_name: str, **kwargs: Any - ) -> Iterable["_models.DnssecConfig"]: - """Lists the DNSSEC configurations in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :return: An iterator like instance of either DnssecConfig or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.DnssecConfig] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.DnssecConfigListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DnssecConfigListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_patch.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_record_sets_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_record_sets_operations.py deleted file mode 100644 index 0f31e1af61dc..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_record_sets_operations.py +++ /dev/null @@ -1,1194 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_update_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "relativeRecordSetName": _SERIALIZER.url( - "relative_record_set_name", relative_record_set_name, "str", skip_quote=True - ), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_type_request( - resource_group_name: str, - zone_name: str, - record_type: Union[str, _models.RecordType], - subscription_id: str, - *, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "recordType": _SERIALIZER.url("record_type", record_type, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if recordsetnamesuffix is not None: - _params["$recordsetnamesuffix"] = _SERIALIZER.query("recordsetnamesuffix", recordsetnamesuffix, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_dns_zone_request( - resource_group_name: str, - zone_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if recordsetnamesuffix is not None: - _params["$recordsetnamesuffix"] = _SERIALIZER.query("recordsetnamesuffix", recordsetnamesuffix, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_all_by_dns_zone_request( - resource_group_name: str, - zone_name: str, - subscription_id: str, - *, - top: Optional[int] = None, - record_set_name_suffix: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/all", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if record_set_name_suffix is not None: - _params["$recordsetnamesuffix"] = _SERIALIZER.query("record_set_name_suffix", record_set_name_suffix, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class RecordSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2023_07_01_preview.DnsManagementClient`'s - :attr:`record_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Updates a record set within a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the Update operation. Is either a RecordSet type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting concurrent - changes. Default value is None. - :type if_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: _models.RecordSet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but - not created (they are created when the DNS zone is created). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but - not created (they are created when the DNS zone is created). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - parameters: Union[_models.RecordSet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.RecordSet: - """Creates or updates a record set within a DNS zone. Record sets of type SOA can be updated but - not created (they are created when the DNS zone is created). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a RecordSet - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet or IO[bytes] - :param if_match: The etag of the record set. Omit this value to always overwrite the current - record set. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new record set to be created, but to prevent - updating an existing record set. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RecordSet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - if_match: Optional[str] = None, - **kwargs: Any - ) -> None: - """Deletes a record set from a DNS zone. This operation cannot be undone. Record sets of type SOA - cannot be deleted (they are deleted when the DNS zone is deleted). - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param if_match: The etag of the record set. Omit this value to always delete the current - record set. Specify the last-seen etag value to prevent accidentally deleting any concurrent - changes. Default value is None. - :type if_match: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - zone_name: str, - relative_record_set_name: str, - record_type: Union[str, _models.RecordType], - **kwargs: Any - ) -> _models.RecordSet: - """Gets a record set. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param relative_record_set_name: The name of the record set, relative to the name of the zone. - Required. - :type relative_record_set_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :return: RecordSet or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RecordSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - relative_record_set_name=relative_record_set_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RecordSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_type( - self, - resource_group_name: str, - zone_name: str, - record_type: Union[str, _models.RecordType], - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RecordSet"]: - """Lists the record sets of a specified type in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param record_type: The type of DNS record in this record set. Known values are: "A", "AAAA", - "CAA", "CNAME", "MX", "NS", "PTR", "SOA", "SRV", "TXT", "TLSA", "DS", and "NAPTR". Required. - :type record_type: str or ~azure.mgmt.dns.v2023_07_01_preview.models.RecordType - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_type_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - record_type=record_type, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_dns_zone( - self, - resource_group_name: str, - zone_name: str, - top: Optional[int] = None, - recordsetnamesuffix: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RecordSet"]: - """Lists all record sets in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param recordsetnamesuffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type recordsetnamesuffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - top=top, - recordsetnamesuffix=recordsetnamesuffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_all_by_dns_zone( - self, - resource_group_name: str, - zone_name: str, - top: Optional[int] = None, - record_set_name_suffix: Optional[str] = None, - **kwargs: Any - ) -> Iterable["_models.RecordSet"]: - """Lists all record sets in a DNS zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :param record_set_name_suffix: The suffix label of the record set name that has to be used to - filter the record set enumerations. If this parameter is specified, Enumeration will return - only records that end with .:code:``. Default value is None. - :type record_set_name_suffix: str - :return: An iterator like instance of either RecordSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.RecordSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.RecordSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_all_by_dns_zone_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - top=top, - record_set_name_suffix=record_set_name_suffix, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RecordSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_zones_operations.py b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_zones_operations.py deleted file mode 100644 index 17e83ae3267b..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/operations/_zones_operations.py +++ /dev/null @@ -1,927 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, - zone_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, zone_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, zone_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, zone_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "zoneName": _SERIALIZER.url("zone_name", zone_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, *, top: Optional[int] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(subscription_id: str, *, top: Optional[int] = None, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ZonesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dns.v2023_07_01_preview.DnsManagementClient`'s - :attr:`zones` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: _models.Zone, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - zone_name: str, - parameters: Union[_models.Zone, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Zone: - """Creates or updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the CreateOrUpdate operation. Is either a Zone type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone or IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new DNS zone to be created, but to prevent updating - an existing zone. Other values will be ignored. Default value is None. - :type if_none_match: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Zone") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, zone_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation - cannot be undone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param if_match: The etag of the DNS zone. Omit this value to always delete the current zone. - Specify the last-seen etag value to prevent accidentally deleting any concurrent changes. - Default value is None. - :type if_match: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - zone_name=zone_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, zone_name: str, **kwargs: Any) -> _models.Zone: - """Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - zone_name: str, - parameters: _models.ZoneUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.ZoneUpdate - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - zone_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Required. - :type parameters: IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - zone_name: str, - parameters: Union[_models.ZoneUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Zone: - """Updates a DNS zone. Does not modify DNS records within the zone. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param zone_name: The name of the DNS zone (without a terminating dot). Required. - :type zone_name: str - :param parameters: Parameters supplied to the Update operation. Is either a ZoneUpdate type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.dns.v2023_07_01_preview.models.ZoneUpdate or IO[bytes] - :param if_match: The etag of the DNS zone. Omit this value to always overwrite the current - zone. Specify the last-seen etag value to prevent accidentally overwriting any concurrent - changes. Default value is None. - :type if_match: str - :return: Zone or the result of cls(response) - :rtype: ~azure.mgmt.dns.v2023_07_01_preview.models.Zone - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Zone] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ZoneUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - zone_name=zone_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Zone", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.Zone"]: - """Lists the DNS zones within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param top: The maximum number of record sets to return. If not specified, returns up to 100 - record sets. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, top: Optional[int] = None, **kwargs: Any) -> Iterable["_models.Zone"]: - """Lists the DNS zones in all resource groups in a subscription. - - :param top: The maximum number of DNS zones to return. If not specified, returns up to 100 - zones. Default value is None. - :type top: int - :return: An iterator like instance of either Zone or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dns.v2023_07_01_preview.models.Zone] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-07-01-preview") - ) - cls: ClsType[_models.ZoneListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ZoneListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/py.typed b/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/network/azure-mgmt-dns/azure/mgmt/dns/v2023_07_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_aaaa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_aaaa_recordset.py index 02fc0284740e..f29b50f7c97c 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_aaaa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_aaaa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_arecordset.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_arecordset.py index 709f9181b537..47e0341b7748 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_arecordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_arecordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_arecordset_alias.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_arecordset_alias.py index c60545c65f34..dad8c8030c77 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_arecordset_alias.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_arecordset_alias.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_caa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_caa_recordset.py index b17a3be834eb..08bc5fe0081b 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_caa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_caa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_cname_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_cname_recordset.py index 3640094a6e43..064c2fbdf82d 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_cname_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_cname_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_mx_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_mx_recordset.py index a0632e6e5dc4..e2dfc541f664 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_mx_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_mx_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_ns_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_ns_recordset.py index 823ff79ba9c3..943c81440a61 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_ns_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_ns_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_ptr_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_ptr_recordset.py index bd23440ab774..6cef3c72c4ef 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_ptr_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_ptr_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_soa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_soa_recordset.py index b351fd5c1296..61c06ffe0159 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_soa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_soa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_srv_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_srv_recordset.py index dff301f8ee81..004a8c35a569 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_srv_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_srv_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_txt_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_txt_recordset.py index 1441860da87a..7e05206c71db 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_txt_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_txt_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_zone.py b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_zone.py index 5ca60f0f7a6f..1ad6b441faa2 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_zone.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/create_or_update_zone.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/delete_aaaa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/delete_aaaa_recordset.py index 0a43a73a9c0b..7c901aa820a6 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/delete_aaaa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/delete_aaaa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/delete_arecordset.py b/sdk/network/azure-mgmt-dns/generated_samples/delete_arecordset.py index a4929fb595d1..140662b8a605 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/delete_arecordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/delete_arecordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/delete_caa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/delete_caa_recordset.py index a21a98d040ed..8c708b2cc57e 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/delete_caa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/delete_caa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/delete_ptr_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/delete_ptr_recordset.py index d52e9fc05327..5a3cf3c0b294 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/delete_ptr_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/delete_ptr_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/delete_srv_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/delete_srv_recordset.py index ea58aee18409..b6fa1291dcbf 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/delete_srv_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/delete_srv_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/delete_txt_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/delete_txt_recordset.py index 556a2dce80b0..6c6f1ddf341a 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/delete_txt_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/delete_txt_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/get_aaaa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/get_aaaa_recordset.py index 992eeaca9f8c..658f0489c4c4 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/get_aaaa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/get_aaaa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/get_caa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/get_caa_recordset.py index 01b060d9c4b8..74da90d9e5b5 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/get_caa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/get_caa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/get_cname_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/get_cname_recordset.py index 553a45901a1c..e50fb8611946 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/get_cname_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/get_cname_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/get_dns_resource_reference.py b/sdk/network/azure-mgmt-dns/generated_samples/get_dns_resource_reference.py index 1e3287ebda1f..14c478321e68 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/get_dns_resource_reference.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/get_dns_resource_reference.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/get_mx_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/get_mx_recordset.py index bd570deda822..37dff40e7a71 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/get_mx_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/get_mx_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/get_ns_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/get_ns_recordset.py index c351bf95413c..bf8d5d3290d0 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/get_ns_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/get_ns_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/get_ptr_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/get_ptr_recordset.py index d61a64863b94..cb7a0fffb6cb 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/get_ptr_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/get_ptr_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/get_soa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/get_soa_recordset.py index d05825b67e4d..9cf1d7fef434 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/get_soa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/get_soa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/get_srv_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/get_srv_recordset.py index a24c2cbd6926..d777484edd37 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/get_srv_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/get_srv_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/get_txt_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/get_txt_recordset.py index 876b3122719e..23712913eef0 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/get_txt_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/get_txt_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_aaaa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/list_aaaa_recordset.py index 05b7c2c4ea65..c485cfc766bd 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_aaaa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_aaaa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_arecordset.py b/sdk/network/azure-mgmt-dns/generated_samples/list_arecordset.py index 96411e7f4370..4098aee864c6 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_arecordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_arecordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_caa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/list_caa_recordset.py index 952deaab0761..56b0cc23549a 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_caa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_caa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_cname_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/list_cname_recordset.py index 61f213d7687a..93c2fb494f0c 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_cname_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_cname_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_mx_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/list_mx_recordset.py index 3928e0271ce9..f2856637e3cf 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_mx_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_mx_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_ns_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/list_ns_recordset.py index 6cb75f2010db..ee64695fdc5a 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_ns_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_ns_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_ptr_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/list_ptr_recordset.py index a7b340aa02a4..5b1608d39338 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_ptr_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_ptr_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_record_sets_by_zone.py b/sdk/network/azure-mgmt-dns/generated_samples/list_record_sets_by_zone.py index a92b8b7552b8..f5b3f8603c17 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_record_sets_by_zone.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_record_sets_by_zone.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -30,7 +31,7 @@ def main(): subscription_id="subid", ) - response = client.record_sets.list_all_by_dns_zone( + response = client.record_sets.list_by_dns_zone( resource_group_name="rg1", zone_name="zone1", ) diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_soa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/list_soa_recordset.py index 1be83cb21d37..2e7f4f55f6fc 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_soa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_soa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_srv_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/list_srv_recordset.py index ab5d52ade6f1..ef861d4d862b 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_srv_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_srv_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_txt_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/list_txt_recordset.py index 5c4ebddbae59..e64c80d3875e 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_txt_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_txt_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_zones_by_resource_group.py b/sdk/network/azure-mgmt-dns/generated_samples/list_zones_by_resource_group.py index f354eb81df74..3b9dccbb3330 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_zones_by_resource_group.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_zones_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/list_zones_by_subscription.py b/sdk/network/azure-mgmt-dns/generated_samples/list_zones_by_subscription.py index 2a9bf8b98935..12fa479ad63a 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/list_zones_by_subscription.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/list_zones_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/patch_aaaa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/patch_aaaa_recordset.py index 7fa443de3150..057a1631926c 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/patch_aaaa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/patch_aaaa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/patch_arecordset.py b/sdk/network/azure-mgmt-dns/generated_samples/patch_arecordset.py index 6dc0cbfe58ef..8c69913a45a7 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/patch_arecordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/patch_arecordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/patch_caa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/patch_caa_recordset.py index dd1666c059c8..50081ec87097 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/patch_caa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/patch_caa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/patch_cname_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/patch_cname_recordset.py index 769ebd53c9e1..c7bbf9863598 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/patch_cname_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/patch_cname_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/patch_mx_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/patch_mx_recordset.py index 6dcd8c73330b..f839276d97ea 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/patch_mx_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/patch_mx_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/patch_ns_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/patch_ns_recordset.py index 285b9b0ef086..82de09da0e09 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/patch_ns_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/patch_ns_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/patch_ptr_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/patch_ptr_recordset.py index 60d1b86ea755..ad10daa15092 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/patch_ptr_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/patch_ptr_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/patch_soa_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/patch_soa_recordset.py index fe01c216609b..b7707887b070 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/patch_soa_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/patch_soa_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/patch_srv_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/patch_srv_recordset.py index 20e71b33d030..8a46d5fac7c1 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/patch_srv_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/patch_srv_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_samples/patch_txt_recordset.py b/sdk/network/azure-mgmt-dns/generated_samples/patch_txt_recordset.py index e8b06d2643cb..2a2a2b49acf6 100644 --- a/sdk/network/azure-mgmt-dns/generated_samples/patch_txt_recordset.py +++ b/sdk/network/azure-mgmt-dns/generated_samples/patch_txt_recordset.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/network/azure-mgmt-dns/generated_tests/conftest.py b/sdk/network/azure-mgmt-dns/generated_tests/conftest.py index f0a4cf60779b..808ddfcdb7ed 100644 --- a/sdk/network/azure-mgmt-dns/generated_tests/conftest.py +++ b/sdk/network/azure-mgmt-dns/generated_tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): dnsmanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") diff --git a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_dns_resource_reference_operations.py b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_dns_resource_reference_operations.py index a5ae2686f316..5b825bc8b6b2 100644 --- a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_dns_resource_reference_operations.py +++ b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_dns_resource_reference_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_by_target_resources(self, resource_group): + def test_dns_resource_reference_get_by_target_resources(self, resource_group): response = self.client.dns_resource_reference.get_by_target_resources( parameters={"targetResources": [{"id": "str"}]}, api_version="2018-05-01", diff --git a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_dns_resource_reference_operations_async.py b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_dns_resource_reference_operations_async.py index c997cef4e57c..37325b1855ef 100644 --- a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_dns_resource_reference_operations_async.py +++ b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_dns_resource_reference_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_by_target_resources(self, resource_group): + async def test_dns_resource_reference_get_by_target_resources(self, resource_group): response = await self.client.dns_resource_reference.get_by_target_resources( parameters={"targetResources": [{"id": "str"}]}, api_version="2018-05-01", diff --git a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_record_sets_operations.py b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_record_sets_operations.py index e050ab0651ca..b325bcd9b046 100644 --- a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_record_sets_operations.py +++ b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_record_sets_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_record_sets_update(self, resource_group): response = self.client.record_sets.update( resource_group_name=resource_group.name, zone_name="str", @@ -63,7 +63,7 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_record_sets_create_or_update(self, resource_group): response = self.client.record_sets.create_or_update( resource_group_name=resource_group.name, zone_name="str", @@ -106,7 +106,7 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_delete(self, resource_group): + def test_record_sets_delete(self, resource_group): response = self.client.record_sets.delete( resource_group_name=resource_group.name, zone_name="str", @@ -120,7 +120,7 @@ def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_record_sets_get(self, resource_group): response = self.client.record_sets.get( resource_group_name=resource_group.name, zone_name="str", @@ -134,7 +134,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_type(self, resource_group): + def test_record_sets_list_by_type(self, resource_group): response = self.client.record_sets.list_by_type( resource_group_name=resource_group.name, zone_name="str", @@ -147,7 +147,7 @@ def test_list_by_type(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_dns_zone(self, resource_group): + def test_record_sets_list_by_dns_zone(self, resource_group): response = self.client.record_sets.list_by_dns_zone( resource_group_name=resource_group.name, zone_name="str", @@ -159,7 +159,7 @@ def test_list_by_dns_zone(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_all_by_dns_zone(self, resource_group): + def test_record_sets_list_all_by_dns_zone(self, resource_group): response = self.client.record_sets.list_all_by_dns_zone( resource_group_name=resource_group.name, zone_name="str", diff --git a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_record_sets_operations_async.py b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_record_sets_operations_async.py index 08df0a1ece9b..796f284df20a 100644 --- a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_record_sets_operations_async.py +++ b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_record_sets_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_record_sets_update(self, resource_group): response = await self.client.record_sets.update( resource_group_name=resource_group.name, zone_name="str", @@ -64,7 +64,7 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_record_sets_create_or_update(self, resource_group): response = await self.client.record_sets.create_or_update( resource_group_name=resource_group.name, zone_name="str", @@ -107,7 +107,7 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_delete(self, resource_group): + async def test_record_sets_delete(self, resource_group): response = await self.client.record_sets.delete( resource_group_name=resource_group.name, zone_name="str", @@ -121,7 +121,7 @@ async def test_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_record_sets_get(self, resource_group): response = await self.client.record_sets.get( resource_group_name=resource_group.name, zone_name="str", @@ -135,7 +135,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_type(self, resource_group): + async def test_record_sets_list_by_type(self, resource_group): response = self.client.record_sets.list_by_type( resource_group_name=resource_group.name, zone_name="str", @@ -148,7 +148,7 @@ async def test_list_by_type(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_dns_zone(self, resource_group): + async def test_record_sets_list_by_dns_zone(self, resource_group): response = self.client.record_sets.list_by_dns_zone( resource_group_name=resource_group.name, zone_name="str", @@ -160,7 +160,7 @@ async def test_list_by_dns_zone(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_all_by_dns_zone(self, resource_group): + async def test_record_sets_list_all_by_dns_zone(self, resource_group): response = self.client.record_sets.list_all_by_dns_zone( resource_group_name=resource_group.name, zone_name="str", diff --git a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_zones_operations.py b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_zones_operations.py index 869781058c57..d754acd74fb3 100644 --- a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_zones_operations.py +++ b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_zones_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_zones_create_or_update(self, resource_group): response = self.client.zones.create_or_update( resource_group_name=resource_group.name, zone_name="str", @@ -47,7 +47,7 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_zones_begin_delete(self, resource_group): response = self.client.zones.begin_delete( resource_group_name=resource_group.name, zone_name="str", @@ -59,7 +59,7 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_zones_get(self, resource_group): response = self.client.zones.get( resource_group_name=resource_group.name, zone_name="str", @@ -71,7 +71,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_zones_update(self, resource_group): response = self.client.zones.update( resource_group_name=resource_group.name, zone_name="str", @@ -84,7 +84,7 @@ def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_zones_list_by_resource_group(self, resource_group): response = self.client.zones.list_by_resource_group( resource_group_name=resource_group.name, api_version="2018-05-01", @@ -95,7 +95,7 @@ def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_zones_list(self, resource_group): response = self.client.zones.list( api_version="2018-05-01", ) diff --git a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_zones_operations_async.py b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_zones_operations_async.py index 8523aa51c0e2..1969971a2a2a 100644 --- a/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_zones_operations_async.py +++ b/sdk/network/azure-mgmt-dns/generated_tests/test_dns_management_zones_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_zones_create_or_update(self, resource_group): response = await self.client.zones.create_or_update( resource_group_name=resource_group.name, zone_name="str", @@ -48,7 +48,7 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_zones_begin_delete(self, resource_group): response = await ( await self.client.zones.begin_delete( resource_group_name=resource_group.name, @@ -62,7 +62,7 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_zones_get(self, resource_group): response = await self.client.zones.get( resource_group_name=resource_group.name, zone_name="str", @@ -74,7 +74,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_zones_update(self, resource_group): response = await self.client.zones.update( resource_group_name=resource_group.name, zone_name="str", @@ -87,7 +87,7 @@ async def test_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_zones_list_by_resource_group(self, resource_group): response = self.client.zones.list_by_resource_group( resource_group_name=resource_group.name, api_version="2018-05-01", @@ -98,7 +98,7 @@ async def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_zones_list(self, resource_group): response = self.client.zones.list( api_version="2018-05-01", ) diff --git a/sdk/network/azure-mgmt-dns/setup.py b/sdk/network/azure-mgmt-dns/setup.py index 248497242b18..63989f123e98 100644 --- a/sdk/network/azure-mgmt-dns/setup.py +++ b/sdk/network/azure-mgmt-dns/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", )