From 726174e1f8e70320779bae008d499f66433d17e3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 3 Nov 2022 07:09:29 +0000 Subject: [PATCH] CodeGen from PR 21407 in Azure/azure-rest-api-specs Merge 9b2e7c5e787509e720bb87d9fb8a6324a9970b10 into fa8bd476e1768f419063cba8c1d696e9f8c43511 --- sdk/security/azure-mgmt-security/_meta.json | 12 +- .../azure/mgmt/security/_security_center.py | 67 + .../mgmt/security/aio/_security_center.py | 67 + .../security/v2015_06_01_preview/__init__.py | 4 +- .../v2015_06_01_preview/_configuration.py | 8 +- .../v2015_06_01_preview/_metadata.json | 2 +- .../security/v2015_06_01_preview/_version.py | 2 +- .../v2015_06_01_preview/aio/__init__.py | 4 +- .../v2015_06_01_preview/aio/_configuration.py | 8 +- .../aio/operations/_locations_operations.py | 28 +- .../aio/operations/_operations.py | 24 +- .../aio/operations/_tasks_operations.py | 78 +- .../v2015_06_01_preview/models/_models_py3.py | 7 +- .../operations/_locations_operations.py | 36 +- .../operations/_operations.py | 28 +- .../operations/_tasks_operations.py | 110 +- .../mgmt/security/v2017_08_01/__init__.py | 4 +- .../security/v2017_08_01/_configuration.py | 8 +- .../mgmt/security/v2017_08_01/_metadata.json | 2 +- .../mgmt/security/v2017_08_01/_version.py | 2 +- .../mgmt/security/v2017_08_01/aio/__init__.py | 4 +- .../v2017_08_01/aio/_configuration.py | 8 +- .../_compliance_results_operations.py | 24 +- .../_compliance_results_operations.py | 28 +- .../security/v2017_08_01_preview/__init__.py | 4 +- .../v2017_08_01_preview/_configuration.py | 8 +- .../v2017_08_01_preview/_metadata.json | 2 +- .../security/v2017_08_01_preview/_version.py | 2 +- .../v2017_08_01_preview/aio/__init__.py | 4 +- .../v2017_08_01_preview/aio/_configuration.py | 8 +- .../_auto_provisioning_settings_operations.py | 32 +- .../aio/operations/_compliances_operations.py | 28 +- ...ormation_protection_policies_operations.py | 40 +- .../_security_contacts_operations.py | 40 +- .../_workspace_settings_operations.py | 40 +- .../_auto_provisioning_settings_operations.py | 44 +- .../operations/_compliances_operations.py | 36 +- ...ormation_protection_policies_operations.py | 56 +- .../_security_contacts_operations.py | 60 +- .../_workspace_settings_operations.py | 60 +- .../mgmt/security/v2018_06_01/__init__.py | 4 +- .../security/v2018_06_01/_configuration.py | 8 +- .../mgmt/security/v2018_06_01/_metadata.json | 2 +- .../mgmt/security/v2018_06_01/_version.py | 2 +- .../mgmt/security/v2018_06_01/aio/__init__.py | 4 +- .../v2018_06_01/aio/_configuration.py | 8 +- .../aio/operations/_pricings_operations.py | 11 +- .../operations/_pricings_operations.py | 17 +- .../mgmt/security/v2019_01_01/__init__.py | 4 +- .../security/v2019_01_01/_configuration.py | 8 +- .../mgmt/security/v2019_01_01/_metadata.json | 2 +- .../mgmt/security/v2019_01_01/_version.py | 2 +- .../mgmt/security/v2019_01_01/aio/__init__.py | 4 +- .../v2019_01_01/aio/_configuration.py | 8 +- .../_advanced_threat_protection_operations.py | 13 +- .../_advanced_threat_protection_operations.py | 21 +- .../security/v2019_01_01_preview/__init__.py | 4 +- .../v2019_01_01_preview/_configuration.py | 8 +- .../v2019_01_01_preview/_metadata.json | 2 +- .../security/v2019_01_01_preview/_version.py | 2 +- .../v2019_01_01_preview/aio/__init__.py | 4 +- .../v2019_01_01_preview/aio/_configuration.py | 8 +- .../_alerts_suppression_rules_operations.py | 36 +- .../aio/operations/_automations_operations.py | 57 +- ...atory_compliance_assessments_operations.py | 28 +- ...gulatory_compliance_controls_operations.py | 28 +- ...ulatory_compliance_standards_operations.py | 28 +- .../operations/_sub_assessments_operations.py | 45 +- .../_alerts_suppression_rules_operations.py | 52 +- .../operations/_automations_operations.py | 81 +- ...atory_compliance_assessments_operations.py | 36 +- ...gulatory_compliance_controls_operations.py | 36 +- ...ulatory_compliance_standards_operations.py | 36 +- .../operations/_sub_assessments_operations.py | 57 +- .../mgmt/security/v2019_08_01/__init__.py | 4 +- .../security/v2019_08_01/_configuration.py | 8 +- .../mgmt/security/v2019_08_01/_metadata.json | 2 +- .../mgmt/security/v2019_08_01/_version.py | 2 +- .../mgmt/security/v2019_08_01/aio/__init__.py | 4 +- .../v2019_08_01/aio/_configuration.py | 8 +- .../_device_security_groups_operations.py | 28 +- ..._security_solution_analytics_operations.py | 9 +- .../_iot_security_solution_operations.py | 45 +- ...s_analytics_aggregated_alert_operations.py | 26 +- ...ons_analytics_recommendation_operations.py | 24 +- .../_device_security_groups_operations.py | 36 +- ..._security_solution_analytics_operations.py | 13 +- .../_iot_security_solution_operations.py | 57 +- ...s_analytics_aggregated_alert_operations.py | 32 +- ...ons_analytics_recommendation_operations.py | 28 +- .../mgmt/security/v2020_01_01/__init__.py | 4 +- .../security/v2020_01_01/_configuration.py | 8 +- .../mgmt/security/v2020_01_01/_metadata.json | 2 +- .../mgmt/security/v2020_01_01/_version.py | 2 +- .../mgmt/security/v2020_01_01/aio/__init__.py | 4 +- .../v2020_01_01/aio/_configuration.py | 8 +- .../v2020_01_01/aio/operations/__init__.py | 33 +- ...daptive_application_controls_operations.py | 145 +- ..._adaptive_network_hardenings_operations.py | 166 +- .../_allowed_connections_operations.py | 139 +- .../_assessments_metadata_operations.py | 226 +- .../aio/operations/_assessments_operations.py | 159 +- ...iscovered_security_solutions_operations.py | 143 +- ..._external_security_solutions_operations.py | 143 +- ..._jit_network_access_policies_operations.py | 322 +- .../v2020_01_01/aio/operations/_patch.py | 1 + ...re_score_control_definitions_operations.py | 114 +- .../_secure_score_controls_operations.py | 108 +- .../operations/_secure_scores_operations.py | 94 +- .../_security_solutions_operations.py | 94 +- ...ity_solutions_reference_data_operations.py | 81 +- ...ver_vulnerability_assessment_operations.py | 204 +- .../aio/operations/_topology_operations.py | 139 +- .../security/v2020_01_01/models/__init__.py | 223 +- .../v2020_01_01/models/_models_py3.py | 813 ++--- .../models/_security_center_enums.py | 120 +- ...daptive_application_controls_operations.py | 21 +- ..._adaptive_network_hardenings_operations.py | 40 +- .../_allowed_connections_operations.py | 49 +- .../_assessments_metadata_operations.py | 57 +- .../operations/_assessments_operations.py | 40 +- ...iscovered_security_solutions_operations.py | 45 +- ..._external_security_solutions_operations.py | 45 +- ..._jit_network_access_policies_operations.py | 95 +- ...re_score_control_definitions_operations.py | 41 +- .../_secure_score_controls_operations.py | 49 +- .../operations/_secure_scores_operations.py | 28 +- .../_security_solutions_operations.py | 28 +- ...ity_solutions_reference_data_operations.py | 13 +- ...ver_vulnerability_assessment_operations.py | 51 +- .../operations/_topology_operations.py | 45 +- .../security/v2020_01_01_preview/__init__.py | 4 +- .../v2020_01_01_preview/_configuration.py | 8 +- .../v2020_01_01_preview/_metadata.json | 2 +- .../security/v2020_01_01_preview/_version.py | 2 +- .../v2020_01_01_preview/aio/__init__.py | 5 +- .../v2020_01_01_preview/aio/_configuration.py | 46 +- .../aio/_security_center.py | 12 +- .../aio/operations/__init__.py | 5 +- .../aio/operations/_connectors_operations.py | 173 +- .../aio/operations/_patch.py | 1 + .../v2020_01_01_preview/models/__init__.py | 37 +- .../v2020_01_01_preview/models/_models_py3.py | 183 +- .../models/_security_center_enums.py | 16 +- .../operations/__init__.py | 5 +- .../operations/_connectors_operations.py | 321 +- .../security/v2020_07_01_preview/__init__.py | 4 +- .../v2020_07_01_preview/_configuration.py | 8 +- .../v2020_07_01_preview/_metadata.json | 2 +- .../security/v2020_07_01_preview/_version.py | 2 +- .../v2020_07_01_preview/aio/__init__.py | 4 +- .../v2020_07_01_preview/aio/_configuration.py | 8 +- ...ty_assessment_baseline_rules_operations.py | 25 +- ...lity_assessment_scan_results_operations.py | 13 +- ...lnerability_assessment_scans_operations.py | 13 +- ...ty_assessment_baseline_rules_operations.py | 45 +- ...lity_assessment_scan_results_operations.py | 21 +- ...lnerability_assessment_scans_operations.py | 21 +- .../mgmt/security/v2021_01_01/__init__.py | 4 +- .../security/v2021_01_01/_configuration.py | 8 +- .../mgmt/security/v2021_01_01/_metadata.json | 2 +- .../mgmt/security/v2021_01_01/_version.py | 2 +- .../mgmt/security/v2021_01_01/aio/__init__.py | 4 +- .../v2021_01_01/aio/_configuration.py | 8 +- .../aio/operations/_alerts_operations.py | 87 +- .../v2021_01_01/models/_models_py3.py | 7 +- .../operations/_alerts_operations.py | 113 +- .../security/v2021_01_15_preview/__init__.py | 4 +- .../v2021_01_15_preview/_configuration.py | 8 +- .../v2021_01_15_preview/_metadata.json | 2 +- .../security/v2021_01_15_preview/_version.py | 2 +- .../v2021_01_15_preview/aio/__init__.py | 4 +- .../v2021_01_15_preview/aio/_configuration.py | 8 +- .../_ingestion_settings_operations.py | 44 +- .../_ingestion_settings_operations.py | 68 +- .../security/v2021_05_01_preview/__init__.py | 4 +- .../v2021_05_01_preview/_configuration.py | 8 +- .../v2021_05_01_preview/_metadata.json | 2 +- .../security/v2021_05_01_preview/_version.py | 2 +- .../v2021_05_01_preview/aio/__init__.py | 4 +- .../v2021_05_01_preview/aio/_configuration.py | 8 +- .../_software_inventories_operations.py | 45 +- .../_software_inventories_operations.py | 57 +- .../mgmt/security/v2021_06_01/__init__.py | 4 +- .../security/v2021_06_01/_configuration.py | 8 +- .../mgmt/security/v2021_06_01/_metadata.json | 2 +- .../mgmt/security/v2021_06_01/_version.py | 2 +- .../mgmt/security/v2021_06_01/aio/__init__.py | 4 +- .../v2021_06_01/aio/_configuration.py | 8 +- .../_assessments_metadata_operations.py | 45 +- .../aio/operations/_assessments_operations.py | 30 +- .../aio/operations/_settings_operations.py | 34 +- .../_assessments_metadata_operations.py | 57 +- .../operations/_assessments_operations.py | 40 +- .../operations/_settings_operations.py | 44 +- .../mgmt/security/v2021_07_01/__init__.py | 4 +- .../security/v2021_07_01/_configuration.py | 8 +- .../mgmt/security/v2021_07_01/_metadata.json | 2 +- .../mgmt/security/v2021_07_01/_version.py | 2 +- .../mgmt/security/v2021_07_01/aio/__init__.py | 5 +- .../v2021_07_01/aio/_configuration.py | 46 +- .../mgmt/security/v2021_07_01/aio/_patch.py | 1 + .../v2021_07_01/aio/_security_center.py | 12 +- .../v2021_07_01/aio/operations/__init__.py | 5 +- .../v2021_07_01/aio/operations/_patch.py | 1 + .../aio/operations/_settings_operations.py | 130 +- .../security/v2021_07_01/models/__init__.py | 21 +- .../v2021_07_01/models/_models_py3.py | 107 +- .../security/v2021_07_01/models/_patch.py | 1 + .../models/_security_center_enums.py | 7 +- .../v2021_07_01/operations/__init__.py | 5 +- .../security/v2021_07_01/operations/_patch.py | 1 + .../operations/_settings_operations.py | 227 +- .../security/v2021_07_01_preview/__init__.py | 4 +- .../v2021_07_01_preview/_configuration.py | 8 +- .../v2021_07_01_preview/_metadata.json | 2 +- .../security/v2021_07_01_preview/_version.py | 2 +- .../v2021_07_01_preview/aio/__init__.py | 4 +- .../v2021_07_01_preview/aio/_configuration.py | 8 +- ...ustom_assessment_automations_operations.py | 53 +- ...tom_entity_store_assignments_operations.py | 53 +- .../_security_connectors_operations.py | 57 +- ...ustom_assessment_automations_operations.py | 73 +- ...tom_entity_store_assignments_operations.py | 73 +- .../_security_connectors_operations.py | 81 +- .../security/v2021_10_01_preview/__init__.py | 4 +- .../v2021_10_01_preview/_configuration.py | 8 +- .../v2021_10_01_preview/_metadata.json | 2 +- .../security/v2021_10_01_preview/_version.py | 2 +- .../v2021_10_01_preview/aio/__init__.py | 4 +- .../v2021_10_01_preview/aio/_configuration.py | 8 +- .../operations/_mde_onboardings_operations.py | 13 +- .../operations/_mde_onboardings_operations.py | 21 +- .../mgmt/security/v2022_01_01/__init__.py | 4 +- .../security/v2022_01_01/_configuration.py | 8 +- .../mgmt/security/v2022_01_01/_metadata.json | 2 +- .../mgmt/security/v2022_01_01/_version.py | 2 +- .../mgmt/security/v2022_01_01/aio/__init__.py | 4 +- .../v2022_01_01/aio/_configuration.py | 8 +- .../aio/operations/_alerts_operations.py | 91 +- .../v2022_01_01/models/_models_py3.py | 7 +- .../operations/_alerts_operations.py | 121 +- .../security/v2022_01_01_preview/__init__.py | 4 +- .../v2022_01_01_preview/_configuration.py | 8 +- .../v2022_01_01_preview/_metadata.json | 2 +- .../security/v2022_01_01_preview/_version.py | 2 +- .../v2022_01_01_preview/aio/__init__.py | 4 +- .../v2022_01_01_preview/aio/_configuration.py | 8 +- .../_governance_assignments_operations.py | 36 +- .../operations/_governance_rule_operations.py | 24 +- .../_governance_rules_operations.py | 33 +- ...ty_connector_governance_rule_operations.py | 24 +- ...ernance_rules_execute_status_operations.py | 13 +- ...y_connector_governance_rules_operations.py | 17 +- ...ernance_rules_execute_status_operations.py | 13 +- .../v2022_01_01_preview/models/_models_py3.py | 7 +- .../_governance_assignments_operations.py | 52 +- .../operations/_governance_rule_operations.py | 28 +- .../_governance_rules_operations.py | 53 +- ...ty_connector_governance_rule_operations.py | 28 +- ...ernance_rules_execute_status_operations.py | 17 +- ...y_connector_governance_rules_operations.py | 29 +- ...ernance_rules_execute_status_operations.py | 17 +- .../mgmt/security/v2022_03_01/__init__.py | 4 +- .../security/v2022_03_01/_configuration.py | 8 +- .../mgmt/security/v2022_03_01/_metadata.json | 2 +- .../mgmt/security/v2022_03_01/_version.py | 2 +- .../mgmt/security/v2022_03_01/aio/__init__.py | 4 +- .../v2022_03_01/aio/_configuration.py | 8 +- .../aio/operations/_pricings_operations.py | 11 +- .../operations/_pricings_operations.py | 17 +- .../mgmt/security/v2022_05_01/__init__.py | 4 +- .../security/v2022_05_01/_configuration.py | 8 +- .../mgmt/security/v2022_05_01/_metadata.json | 2 +- .../mgmt/security/v2022_05_01/_version.py | 2 +- .../mgmt/security/v2022_05_01/aio/__init__.py | 4 +- .../v2022_05_01/aio/_configuration.py | 8 +- .../aio/operations/_settings_operations.py | 34 +- .../operations/_settings_operations.py | 44 +- .../security/v2022_05_01_preview/__init__.py | 4 +- .../v2022_05_01_preview/_configuration.py | 8 +- .../v2022_05_01_preview/_metadata.json | 2 +- .../security/v2022_05_01_preview/_version.py | 2 +- .../v2022_05_01_preview/aio/__init__.py | 4 +- .../v2022_05_01_preview/aio/_configuration.py | 8 +- .../_security_connectors_operations.py | 57 +- .../v2022_05_01_preview/models/_models_py3.py | 7 +- .../_security_connectors_operations.py | 81 +- .../security/v2022_07_01_preview/__init__.py | 4 +- .../v2022_07_01_preview/_configuration.py | 8 +- .../v2022_07_01_preview/_metadata.json | 2 +- .../security/v2022_07_01_preview/_version.py | 2 +- .../v2022_07_01_preview/aio/__init__.py | 4 +- .../v2022_07_01_preview/aio/_configuration.py | 8 +- .../aio/operations/_application_operations.py | 17 +- .../operations/_applications_operations.py | 24 +- ...curity_connector_application_operations.py | 17 +- ...urity_connector_applications_operations.py | 24 +- .../v2022_07_01_preview/models/_models_py3.py | 11 +- .../models/_security_center_enums.py | 2 + .../operations/_application_operations.py | 29 +- .../operations/_applications_operations.py | 28 +- ...curity_connector_application_operations.py | 29 +- ...urity_connector_applications_operations.py | 28 +- .../security/v2022_08_01_preview/__init__.py | 26 + .../v2022_08_01_preview/_configuration.py | 75 + .../v2022_08_01_preview/_metadata.json | 102 + .../security/v2022_08_01_preview/_patch.py | 20 + .../v2022_08_01_preview/_security_center.py | 93 + .../security/v2022_08_01_preview/_vendor.py | 27 + .../security/v2022_08_01_preview/_version.py | 9 + .../v2022_08_01_preview/aio/__init__.py | 23 + .../v2022_08_01_preview/aio/_configuration.py | 72 + .../v2022_08_01_preview/aio/_patch.py | 20 + .../aio/_security_center.py | 90 + .../aio/operations/__init__.py | 19 + .../aio/operations/_patch.py | 20 + .../_security_connectors_operations.py | 651 ++++ .../v2022_08_01_preview/models/__init__.py | 173 ++ .../v2022_08_01_preview/models/_models_py3.py | 2767 +++++++++++++++++ .../v2022_08_01_preview/models/_patch.py | 20 + .../models/_security_center_enums.py | 85 + .../operations/__init__.py | 19 + .../v2022_08_01_preview/operations/_patch.py | 20 + .../_security_connectors_operations.py | 858 +++++ .../security/v2022_08_01_preview/py.typed | 1 + 326 files changed, 11631 insertions(+), 3794 deletions(-) create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_patch.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_patch.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_patch.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_patch.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_security_center_enums.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_patch.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py create mode 100644 sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/py.typed diff --git a/sdk/security/azure-mgmt-security/_meta.json b/sdk/security/azure-mgmt-security/_meta.json index 00c8bc4daefe..9a20dba87240 100644 --- a/sdk/security/azure-mgmt-security/_meta.json +++ b/sdk/security/azure-mgmt-security/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.8.4", + "commit": "f3204698625c0aa0b4c1ebf4cfa1a8bcc890a134", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest": "3.9.2", "use": [ - "@autorest/python@6.1.5", - "@autorest/modelerfour@4.23.5" + "@autorest/python@6.2.1", + "@autorest/modelerfour@4.24.3" ], - "commit": "e21f2da8dacad060a3612dc8ae0fe6de48b15986", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/security/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.5 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False", + "autorest_command": "autorest specification/security/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/security/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py index ec01da6ea1fa..a9cabbbfa717 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py @@ -163,6 +163,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-05-01: :mod:`v2022_05_01.models` * 2022-05-01-preview: :mod:`v2022_05_01_preview.models` * 2022-07-01-preview: :mod:`v2022_07_01_preview.models` + * 2022-08-01-preview: :mod:`v2022_08_01_preview.models` """ if api_version == '2015-06-01-preview': from .v2015_06_01_preview import models @@ -233,6 +234,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-07-01-preview': from .v2022_07_01_preview import models return models + elif api_version == '2022-08-01-preview': + from .v2022_08_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -246,6 +250,7 @@ def adaptive_application_controls(self): from .v2020_01_01.operations import AdaptiveApplicationControlsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'adaptive_application_controls'".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))) @property @@ -259,6 +264,7 @@ def adaptive_network_hardenings(self): from .v2020_01_01.operations import AdaptiveNetworkHardeningsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'adaptive_network_hardenings'".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))) @property @@ -272,6 +278,7 @@ def advanced_threat_protection(self): from .v2019_01_01.operations import AdvancedThreatProtectionOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'advanced_threat_protection'".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))) @property @@ -288,6 +295,7 @@ def alerts(self): from .v2022_01_01.operations import AlertsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'alerts'".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))) @property @@ -301,6 +309,7 @@ def alerts_suppression_rules(self): from .v2019_01_01_preview.operations import AlertsSuppressionRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'alerts_suppression_rules'".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))) @property @@ -314,6 +323,7 @@ def allowed_connections(self): from .v2020_01_01.operations import AllowedConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'allowed_connections'".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))) @property @@ -327,6 +337,7 @@ def application(self): from .v2022_07_01_preview.operations import ApplicationOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'application'".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))) @property @@ -340,6 +351,7 @@ def applications(self): from .v2022_07_01_preview.operations import ApplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'applications'".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))) @property @@ -356,6 +368,7 @@ def assessments(self): from .v2021_06_01.operations import AssessmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'assessments'".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))) @property @@ -372,6 +385,7 @@ def assessments_metadata(self): from .v2021_06_01.operations import AssessmentsMetadataOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'assessments_metadata'".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))) @property @@ -385,6 +399,7 @@ def auto_provisioning_settings(self): from .v2017_08_01_preview.operations import AutoProvisioningSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'auto_provisioning_settings'".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))) @property @@ -398,6 +413,7 @@ def automations(self): from .v2019_01_01_preview.operations import AutomationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'automations'".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))) @property @@ -411,6 +427,7 @@ def compliance_results(self): from .v2017_08_01.operations import ComplianceResultsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'compliance_results'".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))) @property @@ -424,6 +441,7 @@ def compliances(self): from .v2017_08_01_preview.operations import CompliancesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'compliances'".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))) @property @@ -437,6 +455,7 @@ def connectors(self): from .v2020_01_01_preview.operations import ConnectorsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'connectors'".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))) @property @@ -450,6 +469,7 @@ def custom_assessment_automations(self): from .v2021_07_01_preview.operations import CustomAssessmentAutomationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'custom_assessment_automations'".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))) @property @@ -463,6 +483,7 @@ def custom_entity_store_assignments(self): from .v2021_07_01_preview.operations import CustomEntityStoreAssignmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'custom_entity_store_assignments'".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))) @property @@ -476,6 +497,7 @@ def device_security_groups(self): from .v2019_08_01.operations import DeviceSecurityGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'device_security_groups'".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))) @property @@ -489,6 +511,7 @@ def discovered_security_solutions(self): from .v2020_01_01.operations import DiscoveredSecuritySolutionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'discovered_security_solutions'".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))) @property @@ -502,6 +525,7 @@ def external_security_solutions(self): from .v2020_01_01.operations import ExternalSecuritySolutionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'external_security_solutions'".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))) @property @@ -515,6 +539,7 @@ def governance_assignments(self): from .v2022_01_01_preview.operations import GovernanceAssignmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'governance_assignments'".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))) @property @@ -528,6 +553,7 @@ def governance_rule(self): from .v2022_01_01_preview.operations import GovernanceRuleOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'governance_rule'".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))) @property @@ -541,6 +567,7 @@ def governance_rules(self): from .v2022_01_01_preview.operations import GovernanceRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'governance_rules'".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))) @property @@ -554,6 +581,7 @@ def information_protection_policies(self): from .v2017_08_01_preview.operations import InformationProtectionPoliciesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'information_protection_policies'".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))) @property @@ -567,6 +595,7 @@ def ingestion_settings(self): from .v2021_01_15_preview.operations import IngestionSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'ingestion_settings'".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))) @property @@ -580,6 +609,7 @@ def iot_security_solution(self): from .v2019_08_01.operations import IotSecuritySolutionOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_security_solution'".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))) @property @@ -593,6 +623,7 @@ def iot_security_solution_analytics(self): from .v2019_08_01.operations import IotSecuritySolutionAnalyticsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_security_solution_analytics'".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))) @property @@ -606,6 +637,7 @@ def iot_security_solutions_analytics_aggregated_alert(self): from .v2019_08_01.operations import IotSecuritySolutionsAnalyticsAggregatedAlertOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_security_solutions_analytics_aggregated_alert'".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))) @property @@ -619,6 +651,7 @@ def iot_security_solutions_analytics_recommendation(self): from .v2019_08_01.operations import IotSecuritySolutionsAnalyticsRecommendationOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_security_solutions_analytics_recommendation'".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))) @property @@ -632,6 +665,7 @@ def jit_network_access_policies(self): from .v2020_01_01.operations import JitNetworkAccessPoliciesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'jit_network_access_policies'".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))) @property @@ -645,6 +679,7 @@ def locations(self): from .v2015_06_01_preview.operations import LocationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'locations'".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))) @property @@ -658,6 +693,7 @@ def mde_onboardings(self): from .v2021_10_01_preview.operations import MdeOnboardingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'mde_onboardings'".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))) @property @@ -671,6 +707,7 @@ def operations(self): from .v2015_06_01_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".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))) @property @@ -687,6 +724,7 @@ def pricings(self): from .v2022_03_01.operations import PricingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'pricings'".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))) @property @@ -700,6 +738,7 @@ def regulatory_compliance_assessments(self): from .v2019_01_01_preview.operations import RegulatoryComplianceAssessmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'regulatory_compliance_assessments'".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))) @property @@ -713,6 +752,7 @@ def regulatory_compliance_controls(self): from .v2019_01_01_preview.operations import RegulatoryComplianceControlsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'regulatory_compliance_controls'".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))) @property @@ -726,6 +766,7 @@ def regulatory_compliance_standards(self): from .v2019_01_01_preview.operations import RegulatoryComplianceStandardsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'regulatory_compliance_standards'".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))) @property @@ -739,6 +780,7 @@ def secure_score_control_definitions(self): from .v2020_01_01.operations import SecureScoreControlDefinitionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'secure_score_control_definitions'".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))) @property @@ -752,6 +794,7 @@ def secure_score_controls(self): from .v2020_01_01.operations import SecureScoreControlsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'secure_score_controls'".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))) @property @@ -765,6 +808,7 @@ def secure_scores(self): from .v2020_01_01.operations import SecureScoresOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'secure_scores'".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))) @property @@ -778,6 +822,7 @@ def security_connector_application(self): from .v2022_07_01_preview.operations import SecurityConnectorApplicationOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connector_application'".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))) @property @@ -791,6 +836,7 @@ def security_connector_applications(self): from .v2022_07_01_preview.operations import SecurityConnectorApplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connector_applications'".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))) @property @@ -804,6 +850,7 @@ def security_connector_governance_rule(self): from .v2022_01_01_preview.operations import SecurityConnectorGovernanceRuleOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connector_governance_rule'".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))) @property @@ -817,6 +864,7 @@ def security_connector_governance_rules(self): from .v2022_01_01_preview.operations import SecurityConnectorGovernanceRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connector_governance_rules'".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))) @property @@ -830,6 +878,7 @@ def security_connector_governance_rules_execute_status(self): from .v2022_01_01_preview.operations import SecurityConnectorGovernanceRulesExecuteStatusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connector_governance_rules_execute_status'".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))) @property @@ -838,14 +887,18 @@ def security_connectors(self): * 2021-07-01-preview: :class:`SecurityConnectorsOperations` * 2022-05-01-preview: :class:`SecurityConnectorsOperations` + * 2022-08-01-preview: :class:`SecurityConnectorsOperations` """ api_version = self._get_api_version('security_connectors') if api_version == '2021-07-01-preview': from .v2021_07_01_preview.operations import SecurityConnectorsOperations as OperationClass elif api_version == '2022-05-01-preview': from .v2022_05_01_preview.operations import SecurityConnectorsOperations as OperationClass + elif api_version == '2022-08-01-preview': + from .v2022_08_01_preview.operations import SecurityConnectorsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connectors'".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))) @property @@ -859,6 +912,7 @@ def security_contacts(self): from .v2017_08_01_preview.operations import SecurityContactsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_contacts'".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))) @property @@ -872,6 +926,7 @@ def security_solutions(self): from .v2020_01_01.operations import SecuritySolutionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_solutions'".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))) @property @@ -885,6 +940,7 @@ def security_solutions_reference_data(self): from .v2020_01_01.operations import SecuritySolutionsReferenceDataOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_solutions_reference_data'".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))) @property @@ -898,6 +954,7 @@ def server_vulnerability_assessment(self): from .v2020_01_01.operations import ServerVulnerabilityAssessmentOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'server_vulnerability_assessment'".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))) @property @@ -917,6 +974,7 @@ def settings(self): from .v2022_05_01.operations import SettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'settings'".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))) @property @@ -930,6 +988,7 @@ def software_inventories(self): from .v2021_05_01_preview.operations import SoftwareInventoriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'software_inventories'".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))) @property @@ -943,6 +1002,7 @@ def sql_vulnerability_assessment_baseline_rules(self): from .v2020_07_01_preview.operations import SqlVulnerabilityAssessmentBaselineRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'sql_vulnerability_assessment_baseline_rules'".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))) @property @@ -956,6 +1016,7 @@ def sql_vulnerability_assessment_scan_results(self): from .v2020_07_01_preview.operations import SqlVulnerabilityAssessmentScanResultsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'sql_vulnerability_assessment_scan_results'".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))) @property @@ -969,6 +1030,7 @@ def sql_vulnerability_assessment_scans(self): from .v2020_07_01_preview.operations import SqlVulnerabilityAssessmentScansOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'sql_vulnerability_assessment_scans'".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))) @property @@ -982,6 +1044,7 @@ def sub_assessments(self): from .v2019_01_01_preview.operations import SubAssessmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'sub_assessments'".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))) @property @@ -995,6 +1058,7 @@ def subscription_governance_rules_execute_status(self): from .v2022_01_01_preview.operations import SubscriptionGovernanceRulesExecuteStatusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'subscription_governance_rules_execute_status'".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))) @property @@ -1008,6 +1072,7 @@ def tasks(self): from .v2015_06_01_preview.operations import TasksOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'tasks'".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))) @property @@ -1021,6 +1086,7 @@ def topology(self): from .v2020_01_01.operations import TopologyOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'topology'".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))) @property @@ -1034,6 +1100,7 @@ def workspace_settings(self): from .v2017_08_01_preview.operations import WorkspaceSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'workspace_settings'".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))) def close(self): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py index 0e3e80c256c6..88bde0dbc421 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py @@ -163,6 +163,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-05-01: :mod:`v2022_05_01.models` * 2022-05-01-preview: :mod:`v2022_05_01_preview.models` * 2022-07-01-preview: :mod:`v2022_07_01_preview.models` + * 2022-08-01-preview: :mod:`v2022_08_01_preview.models` """ if api_version == '2015-06-01-preview': from ..v2015_06_01_preview import models @@ -233,6 +234,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-07-01-preview': from ..v2022_07_01_preview import models return models + elif api_version == '2022-08-01-preview': + from ..v2022_08_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -246,6 +250,7 @@ def adaptive_application_controls(self): from ..v2020_01_01.aio.operations import AdaptiveApplicationControlsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'adaptive_application_controls'".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))) @property @@ -259,6 +264,7 @@ def adaptive_network_hardenings(self): from ..v2020_01_01.aio.operations import AdaptiveNetworkHardeningsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'adaptive_network_hardenings'".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))) @property @@ -272,6 +278,7 @@ def advanced_threat_protection(self): from ..v2019_01_01.aio.operations import AdvancedThreatProtectionOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'advanced_threat_protection'".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))) @property @@ -288,6 +295,7 @@ def alerts(self): from ..v2022_01_01.aio.operations import AlertsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'alerts'".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))) @property @@ -301,6 +309,7 @@ def alerts_suppression_rules(self): from ..v2019_01_01_preview.aio.operations import AlertsSuppressionRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'alerts_suppression_rules'".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))) @property @@ -314,6 +323,7 @@ def allowed_connections(self): from ..v2020_01_01.aio.operations import AllowedConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'allowed_connections'".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))) @property @@ -327,6 +337,7 @@ def application(self): from ..v2022_07_01_preview.aio.operations import ApplicationOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'application'".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))) @property @@ -340,6 +351,7 @@ def applications(self): from ..v2022_07_01_preview.aio.operations import ApplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'applications'".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))) @property @@ -356,6 +368,7 @@ def assessments(self): from ..v2021_06_01.aio.operations import AssessmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'assessments'".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))) @property @@ -372,6 +385,7 @@ def assessments_metadata(self): from ..v2021_06_01.aio.operations import AssessmentsMetadataOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'assessments_metadata'".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))) @property @@ -385,6 +399,7 @@ def auto_provisioning_settings(self): from ..v2017_08_01_preview.aio.operations import AutoProvisioningSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'auto_provisioning_settings'".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))) @property @@ -398,6 +413,7 @@ def automations(self): from ..v2019_01_01_preview.aio.operations import AutomationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'automations'".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))) @property @@ -411,6 +427,7 @@ def compliance_results(self): from ..v2017_08_01.aio.operations import ComplianceResultsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'compliance_results'".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))) @property @@ -424,6 +441,7 @@ def compliances(self): from ..v2017_08_01_preview.aio.operations import CompliancesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'compliances'".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))) @property @@ -437,6 +455,7 @@ def connectors(self): from ..v2020_01_01_preview.aio.operations import ConnectorsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'connectors'".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))) @property @@ -450,6 +469,7 @@ def custom_assessment_automations(self): from ..v2021_07_01_preview.aio.operations import CustomAssessmentAutomationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'custom_assessment_automations'".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))) @property @@ -463,6 +483,7 @@ def custom_entity_store_assignments(self): from ..v2021_07_01_preview.aio.operations import CustomEntityStoreAssignmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'custom_entity_store_assignments'".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))) @property @@ -476,6 +497,7 @@ def device_security_groups(self): from ..v2019_08_01.aio.operations import DeviceSecurityGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'device_security_groups'".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))) @property @@ -489,6 +511,7 @@ def discovered_security_solutions(self): from ..v2020_01_01.aio.operations import DiscoveredSecuritySolutionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'discovered_security_solutions'".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))) @property @@ -502,6 +525,7 @@ def external_security_solutions(self): from ..v2020_01_01.aio.operations import ExternalSecuritySolutionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'external_security_solutions'".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))) @property @@ -515,6 +539,7 @@ def governance_assignments(self): from ..v2022_01_01_preview.aio.operations import GovernanceAssignmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'governance_assignments'".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))) @property @@ -528,6 +553,7 @@ def governance_rule(self): from ..v2022_01_01_preview.aio.operations import GovernanceRuleOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'governance_rule'".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))) @property @@ -541,6 +567,7 @@ def governance_rules(self): from ..v2022_01_01_preview.aio.operations import GovernanceRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'governance_rules'".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))) @property @@ -554,6 +581,7 @@ def information_protection_policies(self): from ..v2017_08_01_preview.aio.operations import InformationProtectionPoliciesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'information_protection_policies'".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))) @property @@ -567,6 +595,7 @@ def ingestion_settings(self): from ..v2021_01_15_preview.aio.operations import IngestionSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'ingestion_settings'".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))) @property @@ -580,6 +609,7 @@ def iot_security_solution(self): from ..v2019_08_01.aio.operations import IotSecuritySolutionOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_security_solution'".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))) @property @@ -593,6 +623,7 @@ def iot_security_solution_analytics(self): from ..v2019_08_01.aio.operations import IotSecuritySolutionAnalyticsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_security_solution_analytics'".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))) @property @@ -606,6 +637,7 @@ def iot_security_solutions_analytics_aggregated_alert(self): from ..v2019_08_01.aio.operations import IotSecuritySolutionsAnalyticsAggregatedAlertOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_security_solutions_analytics_aggregated_alert'".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))) @property @@ -619,6 +651,7 @@ def iot_security_solutions_analytics_recommendation(self): from ..v2019_08_01.aio.operations import IotSecuritySolutionsAnalyticsRecommendationOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_security_solutions_analytics_recommendation'".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))) @property @@ -632,6 +665,7 @@ def jit_network_access_policies(self): from ..v2020_01_01.aio.operations import JitNetworkAccessPoliciesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'jit_network_access_policies'".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))) @property @@ -645,6 +679,7 @@ def locations(self): from ..v2015_06_01_preview.aio.operations import LocationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'locations'".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))) @property @@ -658,6 +693,7 @@ def mde_onboardings(self): from ..v2021_10_01_preview.aio.operations import MdeOnboardingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'mde_onboardings'".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))) @property @@ -671,6 +707,7 @@ def operations(self): from ..v2015_06_01_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".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))) @property @@ -687,6 +724,7 @@ def pricings(self): from ..v2022_03_01.aio.operations import PricingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'pricings'".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))) @property @@ -700,6 +738,7 @@ def regulatory_compliance_assessments(self): from ..v2019_01_01_preview.aio.operations import RegulatoryComplianceAssessmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'regulatory_compliance_assessments'".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))) @property @@ -713,6 +752,7 @@ def regulatory_compliance_controls(self): from ..v2019_01_01_preview.aio.operations import RegulatoryComplianceControlsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'regulatory_compliance_controls'".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))) @property @@ -726,6 +766,7 @@ def regulatory_compliance_standards(self): from ..v2019_01_01_preview.aio.operations import RegulatoryComplianceStandardsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'regulatory_compliance_standards'".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))) @property @@ -739,6 +780,7 @@ def secure_score_control_definitions(self): from ..v2020_01_01.aio.operations import SecureScoreControlDefinitionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'secure_score_control_definitions'".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))) @property @@ -752,6 +794,7 @@ def secure_score_controls(self): from ..v2020_01_01.aio.operations import SecureScoreControlsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'secure_score_controls'".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))) @property @@ -765,6 +808,7 @@ def secure_scores(self): from ..v2020_01_01.aio.operations import SecureScoresOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'secure_scores'".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))) @property @@ -778,6 +822,7 @@ def security_connector_application(self): from ..v2022_07_01_preview.aio.operations import SecurityConnectorApplicationOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connector_application'".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))) @property @@ -791,6 +836,7 @@ def security_connector_applications(self): from ..v2022_07_01_preview.aio.operations import SecurityConnectorApplicationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connector_applications'".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))) @property @@ -804,6 +850,7 @@ def security_connector_governance_rule(self): from ..v2022_01_01_preview.aio.operations import SecurityConnectorGovernanceRuleOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connector_governance_rule'".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))) @property @@ -817,6 +864,7 @@ def security_connector_governance_rules(self): from ..v2022_01_01_preview.aio.operations import SecurityConnectorGovernanceRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connector_governance_rules'".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))) @property @@ -830,6 +878,7 @@ def security_connector_governance_rules_execute_status(self): from ..v2022_01_01_preview.aio.operations import SecurityConnectorGovernanceRulesExecuteStatusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connector_governance_rules_execute_status'".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))) @property @@ -838,14 +887,18 @@ def security_connectors(self): * 2021-07-01-preview: :class:`SecurityConnectorsOperations` * 2022-05-01-preview: :class:`SecurityConnectorsOperations` + * 2022-08-01-preview: :class:`SecurityConnectorsOperations` """ api_version = self._get_api_version('security_connectors') if api_version == '2021-07-01-preview': from ..v2021_07_01_preview.aio.operations import SecurityConnectorsOperations as OperationClass elif api_version == '2022-05-01-preview': from ..v2022_05_01_preview.aio.operations import SecurityConnectorsOperations as OperationClass + elif api_version == '2022-08-01-preview': + from ..v2022_08_01_preview.aio.operations import SecurityConnectorsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_connectors'".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))) @property @@ -859,6 +912,7 @@ def security_contacts(self): from ..v2017_08_01_preview.aio.operations import SecurityContactsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_contacts'".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))) @property @@ -872,6 +926,7 @@ def security_solutions(self): from ..v2020_01_01.aio.operations import SecuritySolutionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_solutions'".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))) @property @@ -885,6 +940,7 @@ def security_solutions_reference_data(self): from ..v2020_01_01.aio.operations import SecuritySolutionsReferenceDataOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'security_solutions_reference_data'".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))) @property @@ -898,6 +954,7 @@ def server_vulnerability_assessment(self): from ..v2020_01_01.aio.operations import ServerVulnerabilityAssessmentOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'server_vulnerability_assessment'".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))) @property @@ -917,6 +974,7 @@ def settings(self): from ..v2022_05_01.aio.operations import SettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'settings'".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))) @property @@ -930,6 +988,7 @@ def software_inventories(self): from ..v2021_05_01_preview.aio.operations import SoftwareInventoriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'software_inventories'".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))) @property @@ -943,6 +1002,7 @@ def sql_vulnerability_assessment_baseline_rules(self): from ..v2020_07_01_preview.aio.operations import SqlVulnerabilityAssessmentBaselineRulesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'sql_vulnerability_assessment_baseline_rules'".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))) @property @@ -956,6 +1016,7 @@ def sql_vulnerability_assessment_scan_results(self): from ..v2020_07_01_preview.aio.operations import SqlVulnerabilityAssessmentScanResultsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'sql_vulnerability_assessment_scan_results'".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))) @property @@ -969,6 +1030,7 @@ def sql_vulnerability_assessment_scans(self): from ..v2020_07_01_preview.aio.operations import SqlVulnerabilityAssessmentScansOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'sql_vulnerability_assessment_scans'".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))) @property @@ -982,6 +1044,7 @@ def sub_assessments(self): from ..v2019_01_01_preview.aio.operations import SubAssessmentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'sub_assessments'".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))) @property @@ -995,6 +1058,7 @@ def subscription_governance_rules_execute_status(self): from ..v2022_01_01_preview.aio.operations import SubscriptionGovernanceRulesExecuteStatusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'subscription_governance_rules_execute_status'".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))) @property @@ -1008,6 +1072,7 @@ def tasks(self): from ..v2015_06_01_preview.aio.operations import TasksOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'tasks'".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))) @property @@ -1021,6 +1086,7 @@ def topology(self): from ..v2020_01_01.aio.operations import TopologyOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'topology'".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))) @property @@ -1034,6 +1100,7 @@ def workspace_settings(self): from ..v2017_08_01_preview.aio.operations import WorkspaceSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'workspace_settings'".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))) async def close(self): diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py index b06d35a46ae4..c5a559682c88 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-06-01-preview") # type: str + api_version = kwargs.pop("api_version", "2015-06-01-preview") # type: Literal["2015-06-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json index d15b751677b8..251d12e3010f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json @@ -101,4 +101,4 @@ "operations": "Operations", "tasks": "TasksOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py index 9220452a3fdb..acdf00c88a84 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2015-06-01-preview") # type: str + api_version = kwargs.pop("api_version", "2015-06-01-preview") # type: Literal["2015-06-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py index 457c5073a829..8192e2fba9ae 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._locations_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +73,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AscLocation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocationList] error_map = { @@ -94,10 +101,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -151,7 +165,9 @@ async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocation] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py index 18cde6b25fe1..29ad792ed595 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationList] error_map = { @@ -90,10 +97,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py index 6ff807dd349f..b29058c24837 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -38,6 +39,10 @@ build_update_subscription_level_task_state_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +81,9 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] error_map = { @@ -103,10 +110,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -157,7 +171,9 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] error_map = { @@ -185,10 +201,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -246,7 +269,9 @@ async def get_subscription_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] request = build_get_subscription_level_task_request( @@ -285,7 +310,7 @@ async def update_subscription_level_task_state( # pylint: disable=inconsistent- self, asc_location: str, task_name: str, - task_update_action_type: Union[str, "_models.TaskUpdateActionType"], + task_update_action_type: Union[str, _models.TaskUpdateActionType], **kwargs: Any ) -> None: """Recommended tasks that will help improve the security of the subscription proactively. @@ -315,7 +340,9 @@ async def update_subscription_level_task_state( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_task_state_request( @@ -369,7 +396,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] error_map = { @@ -398,10 +427,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -462,7 +498,9 @@ async def get_resource_group_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] request = build_get_resource_group_level_task_request( @@ -503,7 +541,7 @@ async def update_resource_group_level_task_state( # pylint: disable=inconsisten resource_group_name: str, asc_location: str, task_name: str, - task_update_action_type: Union[str, "_models.TaskUpdateActionType"], + task_update_action_type: Union[str, _models.TaskUpdateActionType], **kwargs: Any ) -> None: """Recommended tasks that will help improve the security of the subscription proactively. @@ -536,7 +574,9 @@ async def update_resource_group_level_task_state( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_task_state_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py index 9755b20cb6ff..01d1fdf0e11b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/models/_models_py3.py @@ -12,13 +12,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py index 94a567c26ec3..a6ae0bc51282 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,9 @@ def build_get_request(asc_location: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -125,7 +134,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.AscLocation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocationList] error_map = { @@ -151,10 +162,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -208,7 +226,9 @@ def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AscLocation] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py index 0d153f8197b7..49b52920f5cf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +93,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationList] error_map = { @@ -111,10 +120,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py index 3626829cc85a..bd53fab9ae24 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +77,9 @@ def build_list_by_home_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +112,9 @@ def build_get_subscription_level_task_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,14 +144,16 @@ def build_get_subscription_level_task_request( def build_update_subscription_level_task_state_request( asc_location: str, task_name: str, - task_update_action_type: Union[str, "_models.TaskUpdateActionType"], + task_update_action_type: Union[str, _models.TaskUpdateActionType], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -174,7 +187,9 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -211,7 +226,9 @@ def build_get_resource_group_level_task_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -245,14 +262,16 @@ def build_update_resource_group_level_task_state_request( resource_group_name: str, asc_location: str, task_name: str, - task_update_action_type: Union[str, "_models.TaskUpdateActionType"], + task_update_action_type: Union[str, _models.TaskUpdateActionType], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -317,7 +336,9 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] error_map = { @@ -344,10 +365,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -398,7 +426,9 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] error_map = { @@ -426,10 +456,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -485,7 +522,9 @@ def get_subscription_level_task(self, asc_location: str, task_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] request = build_get_subscription_level_task_request( @@ -524,7 +563,7 @@ def update_subscription_level_task_state( # pylint: disable=inconsistent-return self, asc_location: str, task_name: str, - task_update_action_type: Union[str, "_models.TaskUpdateActionType"], + task_update_action_type: Union[str, _models.TaskUpdateActionType], **kwargs: Any ) -> None: """Recommended tasks that will help improve the security of the subscription proactively. @@ -554,7 +593,9 @@ def update_subscription_level_task_state( # pylint: disable=inconsistent-return _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_task_state_request( @@ -608,7 +649,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTaskList] error_map = { @@ -637,10 +680,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -701,7 +751,9 @@ def get_resource_group_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityTask] request = build_get_resource_group_level_task_request( @@ -742,7 +794,7 @@ def update_resource_group_level_task_state( # pylint: disable=inconsistent-retu resource_group_name: str, asc_location: str, task_name: str, - task_update_action_type: Union[str, "_models.TaskUpdateActionType"], + task_update_action_type: Union[str, _models.TaskUpdateActionType], **kwargs: Any ) -> None: """Recommended tasks that will help improve the security of the subscription proactively. @@ -775,7 +827,9 @@ def update_resource_group_level_task_state( # pylint: disable=inconsistent-retu _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2015-06-01-preview") + ) # type: Literal["2015-06-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_task_state_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py index b2b5163fc823..7c2f0329f3c1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -34,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01") # type: str + api_version = kwargs.pop("api_version", "2017-08-01") # type: Literal["2017-08-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json index 809d36282025..a3d9e73ca6f8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json @@ -87,4 +87,4 @@ "operation_groups": { "compliance_results": "ComplianceResultsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py index 5a5a74c8da9b..a9eb28389fa5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -34,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01") # type: str + api_version = kwargs.pop("api_version", "2017-08-01") # type: Literal["2017-08-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py index edaa4ba85c7e..0c69edc315df 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._compliance_results_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,7 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.ComplianceRe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResultList] error_map = { @@ -96,10 +101,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -154,7 +166,7 @@ async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResult] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py index 1489239f21b8..b62b7604b5c2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +69,7 @@ def build_get_request(resource_id: str, compliance_result_name: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +127,7 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.ComplianceResult" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResultList] error_map = { @@ -148,10 +153,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -206,7 +218,7 @@ def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) # type: Literal["2017-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceResult] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py index 46043a171d74..93d7fbe4adcb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01-preview") # type: str + api_version = kwargs.pop("api_version", "2017-08-01-preview") # type: Literal["2017-08-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json index f2bc142b961c..b1b962d4083c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json @@ -103,4 +103,4 @@ "security_contacts": "SecurityContactsOperations", "workspace_settings": "WorkspaceSettingsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py index a11c9bf2cb31..00d25b5afc26 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2017-08-01-preview") # type: str + api_version = kwargs.pop("api_version", "2017-08-01-preview") # type: Literal["2017-08-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py index b744df15fb60..3550d9f4a2b4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -34,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AutoProvisioningSetting" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSettingList] error_map = { @@ -97,10 +104,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -153,7 +167,9 @@ async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisionin _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] request = build_get_request( @@ -258,7 +274,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py index b21cfe52fcb0..461dcaad1f17 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._compliances_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,9 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Compliance"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceList] error_map = { @@ -96,10 +103,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -156,7 +170,9 @@ async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Compliance] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py index 497223be13a5..089089b739d3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -34,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +66,7 @@ def __init__(self, *args, **kwargs) -> None: async def get( self, scope: str, - information_protection_policy_name: Union[str, "_models.InformationProtectionPolicyName"], + information_protection_policy_name: Union[str, _models.InformationProtectionPolicyName], **kwargs: Any ) -> _models.InformationProtectionPolicy: """Details of the information protection policy. @@ -90,7 +95,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] request = build_get_request( @@ -127,7 +134,7 @@ async def get( async def create_or_update( self, scope: str, - information_protection_policy_name: Union[str, "_models.InformationProtectionPolicyName"], + information_protection_policy_name: Union[str, _models.InformationProtectionPolicyName], information_protection_policy: _models.InformationProtectionPolicy, *, content_type: str = "application/json", @@ -159,7 +166,7 @@ async def create_or_update( async def create_or_update( self, scope: str, - information_protection_policy_name: Union[str, "_models.InformationProtectionPolicyName"], + information_protection_policy_name: Union[str, _models.InformationProtectionPolicyName], information_protection_policy: IO, *, content_type: str = "application/json", @@ -190,7 +197,7 @@ async def create_or_update( async def create_or_update( self, scope: str, - information_protection_policy_name: Union[str, "_models.InformationProtectionPolicyName"], + information_protection_policy_name: Union[str, _models.InformationProtectionPolicyName], information_protection_policy: Union[_models.InformationProtectionPolicy, IO], **kwargs: Any ) -> _models.InformationProtectionPolicy: @@ -227,7 +234,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] @@ -294,7 +303,9 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.InformationP _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicyList] error_map = { @@ -320,10 +331,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py index 4ddc3f763ad1..3c4645fac8a9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +77,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityContact"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContactList] error_map = { @@ -98,10 +105,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -154,7 +168,9 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] request = build_get_request( @@ -260,7 +276,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] @@ -329,7 +347,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -431,7 +451,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py index 0275f7763a9b..3aadca5bb094 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.WorkspaceSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSettingList] error_map = { @@ -99,10 +106,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -156,7 +170,9 @@ async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.Works _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] request = build_get_request( @@ -267,7 +283,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] @@ -390,7 +408,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] @@ -460,7 +480,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py index 9ef440fda985..c4caaaa8c4ca 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +75,9 @@ def build_get_request(setting_name: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +107,9 @@ def build_create_request(setting_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -160,7 +171,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.AutoProvisioningSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSettingList] error_map = { @@ -186,10 +199,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -242,7 +262,9 @@ def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetti _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] request = build_get_request( @@ -347,7 +369,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutoProvisioningSetting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py index ae622aad907f..d29f85ec3a43 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +71,9 @@ def build_get_request(scope: str, compliance_name: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +130,9 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.Compliance"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ComplianceList] error_map = { @@ -147,10 +158,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -207,7 +225,9 @@ def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compli _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Compliance] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py index 8d98f47ae9be..63720c65bf74 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,12 +42,14 @@ def build_get_request( - scope: str, information_protection_policy_name: Union[str, "_models.InformationProtectionPolicyName"], **kwargs: Any + scope: str, information_protection_policy_name: Union[str, _models.InformationProtectionPolicyName], **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,12 +76,14 @@ def build_get_request( def build_create_or_update_request( - scope: str, information_protection_policy_name: Union[str, "_models.InformationProtectionPolicyName"], **kwargs: Any + scope: str, information_protection_policy_name: Union[str, _models.InformationProtectionPolicyName], **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -107,7 +116,9 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +161,7 @@ def __init__(self, *args, **kwargs): def get( self, scope: str, - information_protection_policy_name: Union[str, "_models.InformationProtectionPolicyName"], + information_protection_policy_name: Union[str, _models.InformationProtectionPolicyName], **kwargs: Any ) -> _models.InformationProtectionPolicy: """Details of the information protection policy. @@ -179,7 +190,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] request = build_get_request( @@ -216,7 +229,7 @@ def get( def create_or_update( self, scope: str, - information_protection_policy_name: Union[str, "_models.InformationProtectionPolicyName"], + information_protection_policy_name: Union[str, _models.InformationProtectionPolicyName], information_protection_policy: _models.InformationProtectionPolicy, *, content_type: str = "application/json", @@ -248,7 +261,7 @@ def create_or_update( def create_or_update( self, scope: str, - information_protection_policy_name: Union[str, "_models.InformationProtectionPolicyName"], + information_protection_policy_name: Union[str, _models.InformationProtectionPolicyName], information_protection_policy: IO, *, content_type: str = "application/json", @@ -279,7 +292,7 @@ def create_or_update( def create_or_update( self, scope: str, - information_protection_policy_name: Union[str, "_models.InformationProtectionPolicyName"], + information_protection_policy_name: Union[str, _models.InformationProtectionPolicyName], information_protection_policy: Union[_models.InformationProtectionPolicy, IO], **kwargs: Any ) -> _models.InformationProtectionPolicy: @@ -316,7 +329,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicy] @@ -383,7 +398,9 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.InformationProtec _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.InformationProtectionPolicyList] error_map = { @@ -409,10 +426,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py index 71c4974a0d0b..26de75d54020 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,9 @@ def build_get_request(security_contact_name: str, subscription_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +105,9 @@ def build_create_request(security_contact_name: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -129,7 +140,9 @@ def build_delete_request(security_contact_name: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +172,9 @@ def build_update_request(security_contact_name: str, subscription_id: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -220,7 +235,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityContact"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContactList] error_map = { @@ -246,10 +263,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -302,7 +326,9 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] request = build_get_request( @@ -408,7 +434,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] @@ -477,7 +505,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -579,7 +609,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityContact] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py index dd4635121972..e246cf1e71b5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,9 @@ def build_get_request(workspace_setting_name: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +105,9 @@ def build_create_request(workspace_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -129,7 +140,9 @@ def build_update_request(workspace_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -162,7 +175,9 @@ def build_delete_request(workspace_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -221,7 +236,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.WorkspaceSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSettingList] error_map = { @@ -247,10 +264,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -304,7 +328,9 @@ def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] request = build_get_request( @@ -415,7 +441,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] @@ -538,7 +566,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkspaceSetting] @@ -608,7 +638,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2017-08-01-preview") + ) # type: Literal["2017-08-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py index 0281c36f13a3..1a9383b9ca50 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-06-01") # type: str + api_version = kwargs.pop("api_version", "2018-06-01") # type: Literal["2018-06-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json index d7403e5aa6ae..a257924c29e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "pricings": "PricingsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py index 198a0d9cc031..71ecbf233ba3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2018-06-01") # type: str + api_version = kwargs.pop("api_version", "2018-06-01") # type: Literal["2018-06-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py index 120fed75b73c..16cf1bb363a4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._pricings_operations import build_get_request, build_list_request, build_update_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] request = build_list_request( @@ -124,7 +129,7 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] request = build_get_request( @@ -222,7 +227,7 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py index be74c863b0b3..f45646b09a91 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +69,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +98,7 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -160,7 +165,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] request = build_list_request( @@ -214,7 +219,7 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] request = build_get_request( @@ -312,7 +317,7 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) # type: Literal["2018-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py index 3ea0c3b424ca..e06429a27991 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -34,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01") # type: str + api_version = kwargs.pop("api_version", "2019-01-01") # type: Literal["2019-01-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json index 1354c53972c1..5b738d4c8656 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json @@ -87,4 +87,4 @@ "operation_groups": { "advanced_threat_protection": "AdvancedThreatProtectionOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py index b5facb33c489..5d8fbb0d22b9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -34,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01") # type: str + api_version = kwargs.pop("api_version", "2019-01-01") # type: Literal["2019-01-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py index 6651995275d1..28684d54f261 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._advanced_threat_protection_operations import build_create_request, build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,8 +80,8 @@ async def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatPr _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: str - setting_name = kwargs.pop("setting_name", "current") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] + setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] request = build_get_request( @@ -201,8 +206,8 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: str - setting_name = kwargs.pop("setting_name", "current") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] + setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py index b2e858629f03..28b043a74cbb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +43,8 @@ def build_get_request(resource_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: str - setting_name = kwargs.pop("setting_name", "current") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] + setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,8 +71,8 @@ def build_create_request(resource_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: str - setting_name = kwargs.pop("setting_name", "current") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] + setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -137,8 +142,8 @@ def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtecti _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: str - setting_name = kwargs.pop("setting_name", "current") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] + setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] request = build_get_request( @@ -263,8 +268,8 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: str - setting_name = kwargs.pop("setting_name", "current") # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) # type: Literal["2019-01-01"] + setting_name = kwargs.pop("setting_name", "current") # type: Literal["current"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AdvancedThreatProtectionSetting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py index e84e5e718ea9..e0525d39cb17 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01-preview") # type: str + api_version = kwargs.pop("api_version", "2019-01-01-preview") # type: Literal["2019-01-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json index ff1244d9151c..65712a8b6388 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json @@ -104,4 +104,4 @@ "automations": "AutomationsOperations", "alerts_suppression_rules": "AlertsSuppressionRulesOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py index f0095709a25b..6cd221fea7b4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-01-01-preview") # type: str + api_version = kwargs.pop("api_version", "2019-01-01-preview") # type: Literal["2019-01-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py index ca30d57d9e64..eeb3135f3277 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,9 @@ def list(self, alert_type: Optional[str] = None, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRulesList] error_map = { @@ -101,10 +108,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -157,7 +171,9 @@ async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] request = build_get_request( @@ -273,7 +289,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] @@ -342,7 +360,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py index b12943e523ef..6947366b1082 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,6 +38,10 @@ build_validate_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Automation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] error_map = { @@ -100,10 +107,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -151,7 +165,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] error_map = { @@ -178,10 +194,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -237,7 +260,9 @@ async def get(self, resource_group_name: str, automation_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] request = build_get_request( @@ -363,7 +388,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] @@ -440,7 +467,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -562,7 +591,9 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationValidationStatus] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py index d5152401b526..0da66fe3d056 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._regulatory_compliance_assessments_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessmentList] error_map = { @@ -110,10 +117,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -179,7 +193,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessment] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py index 9e430e1a06ae..c33dad3da474 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._regulatory_compliance_controls_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControlList] error_map = { @@ -102,10 +109,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -164,7 +178,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControl] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py index c47981d793f1..a1a59794d533 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._regulatory_compliance_standards_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandardList] error_map = { @@ -98,10 +105,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -157,7 +171,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandard] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py index 87793731b44b..3522593c3c28 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._sub_assessments_operations import build_get_request, build_list_all_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +76,9 @@ def list_all(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Security _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] error_map = { @@ -97,10 +104,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -151,7 +165,9 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] error_map = { @@ -178,10 +194,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -243,7 +266,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessment] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py index 88cc4530e664..276f7999f3a4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(subscription_id: str, *, alert_type: Optional[str] = None _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +77,9 @@ def build_get_request(alerts_suppression_rule_name: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +111,9 @@ def build_update_request(alerts_suppression_rule_name: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -137,7 +148,9 @@ def build_delete_request(alerts_suppression_rule_name: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +213,9 @@ def list(self, alert_type: Optional[str] = None, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRulesList] error_map = { @@ -227,10 +242,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -283,7 +305,9 @@ def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.Alert _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] request = build_get_request( @@ -399,7 +423,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertsSuppressionRule] @@ -468,7 +494,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py index 7120814a31b7..0a0b26b9ab24 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +146,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -173,7 +186,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +223,9 @@ def build_validate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -273,7 +290,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Automation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] error_map = { @@ -299,10 +318,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -350,7 +376,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationList] error_map = { @@ -377,10 +405,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -436,7 +471,9 @@ def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] request = build_get_request( @@ -562,7 +599,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Automation] @@ -639,7 +678,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -761,7 +802,9 @@ def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AutomationValidationStatus] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py index ef0d2b6767a2..60392fa32a0e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +97,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +180,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessmentList] error_map = { @@ -200,10 +211,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -269,7 +287,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceAssessment] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py index 8313724415c1..ece9fd34ccb4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +88,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +161,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControlList] error_map = { @@ -180,10 +191,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -242,7 +260,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceControl] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py index eb856292c339..6a5a0161789e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +77,9 @@ def build_get_request(regulatory_compliance_standard_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +142,9 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandardList] error_map = { @@ -160,10 +171,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -217,7 +235,9 @@ def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RegulatoryComplianceStandard] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py index 94e8b359f07a..a4ddd7978895 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_all_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +71,9 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +100,9 @@ def build_get_request(scope: str, assessment_name: str, sub_assessment_name: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +164,9 @@ def list_all(self, scope: str, **kwargs: Any) -> Iterable["_models.SecuritySubAs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] error_map = { @@ -179,10 +192,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -233,7 +253,9 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessmentList] error_map = { @@ -260,10 +282,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -325,7 +354,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2019-01-01-preview") + ) # type: Literal["2019-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySubAssessment] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py index a4a64b1c590f..0eef7f710a06 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-08-01") # type: str + api_version = kwargs.pop("api_version", "2019-08-01") # type: Literal["2019-08-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json index 043490fe1983..fb4dc9f00646 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json @@ -103,4 +103,4 @@ "iot_security_solutions_analytics_recommendation": "IotSecuritySolutionsAnalyticsRecommendationOperations", "iot_security_solution": "IotSecuritySolutionOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py index 32a72d16e481..ad5b17e974bf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2019-08-01") # type: str + api_version = kwargs.pop("api_version", "2019-08-01") # type: Literal["2019-08-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py index 098b1667b0ff..cbbc47d24a29 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +78,7 @@ def list(self, resource_id: str, **kwargs: Any) -> AsyncIterable["_models.Device _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroupList] error_map = { @@ -99,10 +104,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -160,7 +172,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] request = build_get_request( @@ -289,7 +301,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] @@ -365,7 +377,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py index 9712b886479c..d2a8e768d80e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._iot_security_solution_analytics_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] request = build_list_request( @@ -138,7 +143,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModel] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py index 38a56933938b..864360becbec 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,6 +38,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +84,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] error_map = { @@ -106,10 +111,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -162,7 +174,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] error_map = { @@ -190,10 +202,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -251,7 +270,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] request = build_get_request( @@ -380,7 +399,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] @@ -528,7 +547,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] @@ -601,7 +620,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py index 72740bf605a4..313373854892 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -34,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,7 +85,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlertList] error_map = { @@ -109,10 +114,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -173,7 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlert] request = build_get_request( @@ -237,7 +249,7 @@ async def dismiss( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_dismiss_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py index 3a62e51ff336..363466f760d9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +92,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendation] request = build_get_request( @@ -146,7 +151,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendationList] error_map = { @@ -175,10 +180,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py index 31d54fd86369..4d8448b0db33 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(resource_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +69,7 @@ def build_get_request(resource_id: str, device_security_group_name: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +96,7 @@ def build_create_or_update_request(resource_id: str, device_security_group_name: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -121,7 +126,7 @@ def build_delete_request(resource_id: str, device_security_group_name: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +183,7 @@ def list(self, resource_id: str, **kwargs: Any) -> Iterable["_models.DeviceSecur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroupList] error_map = { @@ -204,10 +209,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -263,7 +275,7 @@ def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] request = build_get_request( @@ -392,7 +404,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.DeviceSecurityGroup] @@ -468,7 +480,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py index fed0d4ba863a..4388c6b46011 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -73,7 +78,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +153,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] request = build_list_request( @@ -209,7 +214,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionAnalyticsModel] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py index 6846c4276306..51e5cf8b82f6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +79,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +113,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +148,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -181,7 +186,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -219,7 +224,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +291,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] error_map = { @@ -313,10 +318,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -369,7 +381,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionsList] error_map = { @@ -397,10 +409,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -456,7 +475,7 @@ def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] request = build_get_request( @@ -585,7 +604,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] @@ -733,7 +752,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecuritySolutionModel] @@ -806,7 +825,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py index e376ddea0699..bee10b9a1908 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +120,7 @@ def build_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -187,7 +192,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlertList] error_map = { @@ -216,10 +221,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -280,7 +292,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedAlert] request = build_get_request( @@ -344,7 +356,7 @@ def dismiss( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_dismiss_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py index eb4a40ddd39a..c29f12f7c3b0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +89,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +170,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendation] request = build_get_request( @@ -224,7 +229,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) # type: Literal["2019-08-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IoTSecurityAggregatedRecommendationList] error_map = { @@ -253,10 +258,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py index 8a0246a8f30f..fa080065851b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01") # type: str + api_version = kwargs.pop("api_version", "2020-01-01") # type: Literal["2020-01-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json index be1c5d7c93ef..ba0549615a76 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json @@ -113,4 +113,4 @@ "secure_score_control_definitions": "SecureScoreControlDefinitionsOperations", "security_solutions": "SecuritySolutionsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py index 77c3a1c02686..9847128e0ae1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01") # type: str + api_version = kwargs.pop("api_version", "2020-01-01") # type: Literal["2020-01-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py index 97fd501f9bb3..8f44c7940e4b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py @@ -25,22 +25,23 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ServerVulnerabilityAssessmentOperations', - 'AssessmentsMetadataOperations', - 'AssessmentsOperations', - 'AdaptiveApplicationControlsOperations', - 'AdaptiveNetworkHardeningsOperations', - 'AllowedConnectionsOperations', - 'TopologyOperations', - 'JitNetworkAccessPoliciesOperations', - 'DiscoveredSecuritySolutionsOperations', - 'SecuritySolutionsReferenceDataOperations', - 'ExternalSecuritySolutionsOperations', - 'SecureScoresOperations', - 'SecureScoreControlsOperations', - 'SecureScoreControlDefinitionsOperations', - 'SecuritySolutionsOperations', + "ServerVulnerabilityAssessmentOperations", + "AssessmentsMetadataOperations", + "AssessmentsOperations", + "AdaptiveApplicationControlsOperations", + "AdaptiveNetworkHardeningsOperations", + "AllowedConnectionsOperations", + "TopologyOperations", + "JitNetworkAccessPoliciesOperations", + "DiscoveredSecuritySolutionsOperations", + "SecuritySolutionsReferenceDataOperations", + "ExternalSecuritySolutionsOperations", + "SecureScoresOperations", + "SecureScoreControlsOperations", + "SecureScoreControlDefinitionsOperations", + "SecuritySolutionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py index fc559163caef..bfd1f3c2973c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py @@ -6,9 +6,17 @@ # 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, IO, Optional, TypeVar, Union, overload -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -18,10 +26,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._adaptive_application_controls_operations import build_delete_request, build_get_request, build_list_request, build_put_request -T = TypeVar('T') +from ...operations._adaptive_application_controls_operations import ( + build_delete_request, + build_get_request, + build_list_request, + build_put_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AdaptiveApplicationControlsOperations: """ .. warning:: @@ -41,13 +60,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list( - self, - include_path_recommendations: Optional[bool] = None, - summary: Optional[bool] = None, - **kwargs: Any + self, include_path_recommendations: Optional[bool] = None, summary: Optional[bool] = None, **kwargs: Any ) -> _models.AdaptiveApplicationControlGroups: """Gets a list of application control machine groups for the subscription. @@ -61,23 +76,25 @@ async def list( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AdaptiveApplicationControlGroups] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroups] - request = build_list_request( subscription_id=self._config.subscription_id, include_path_recommendations=include_path_recommendations, summary=summary, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -85,9 +102,7 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -96,23 +111,17 @@ async def list( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AdaptiveApplicationControlGroups', pipeline_response) + deserialized = self._deserialize("AdaptiveApplicationControlGroups", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings"} # type: ignore @distributed_trace_async - async def get( - self, - asc_location: str, - group_name: str, - **kwargs: Any - ) -> _models.AdaptiveApplicationControlGroup: + async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.AdaptiveApplicationControlGroup: """Gets an application control VM/server group. :param asc_location: The location where ASC stores the data of the subscription. can be @@ -126,23 +135,25 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AdaptiveApplicationControlGroup] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] - request = build_get_request( asc_location=asc_location, group_name=group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -150,9 +161,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -161,15 +170,14 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AdaptiveApplicationControlGroup', pipeline_response) + deserialized = self._deserialize("AdaptiveApplicationControlGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore @overload async def put( @@ -201,13 +209,7 @@ async def put( @overload async def put( - self, - asc_location: str, - group_name: str, - body: IO, - *, - content_type: str = "application/json", - **kwargs: Any + self, asc_location: str, group_name: str, body: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.AdaptiveApplicationControlGroup: """Update an application control machine group. @@ -227,7 +229,6 @@ async def put( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async async def put( self, @@ -254,16 +255,19 @@ async def put( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.AdaptiveApplicationControlGroup] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] content_type = content_type or "application/json" _json = None @@ -271,7 +275,7 @@ async def put( if isinstance(body, (IO, bytes)): _content = body else: - _json = self._serialize.body(body, 'AdaptiveApplicationControlGroup') + _json = self._serialize.body(body, "AdaptiveApplicationControlGroup") request = build_put_request( asc_location=asc_location, @@ -281,7 +285,7 @@ async def put( content_type=content_type, json=_json, content=_content, - template_url=self.put.metadata['url'], + template_url=self.put.metadata["url"], headers=_headers, params=_params, ) @@ -289,9 +293,7 @@ async def put( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -300,22 +302,18 @@ async def put( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AdaptiveApplicationControlGroup', pipeline_response) + deserialized = self._deserialize("AdaptiveApplicationControlGroup", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - put.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore - + put.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - asc_location: str, - group_name: str, - **kwargs: Any + self, asc_location: str, group_name: str, **kwargs: Any ) -> None: """Delete an application control machine group. @@ -330,23 +328,25 @@ async def delete( # pylint: disable=inconsistent-return-statements :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( asc_location=asc_location, group_name=group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -354,9 +354,7 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -368,5 +366,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py index c29732ca7356..42a8ec4659a4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -23,10 +31,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._adaptive_network_hardenings_operations import build_enforce_request, build_get_request, build_list_by_extended_resource_request -T = TypeVar('T') +from ...operations._adaptive_network_hardenings_operations import ( + build_enforce_request, + build_get_request, + build_list_by_extended_resource_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AdaptiveNetworkHardeningsOperations: """ .. warning:: @@ -46,15 +64,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_extended_resource( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any ) -> AsyncIterable["_models.AdaptiveNetworkHardening"]: """Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. @@ -77,16 +89,20 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AdaptiveNetworkHardeningsList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardeningsList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_extended_resource_request( resource_group_name=resource_group_name, resource_namespace=resource_namespace, @@ -94,7 +110,7 @@ def prepare_request(next_link=None): resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_extended_resource.metadata['url'], + template_url=self.list_by_extended_resource.metadata["url"], headers=_headers, params=_params, ) @@ -103,10 +119,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -123,9 +146,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -135,11 +156,9 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_extended_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings"} # type: ignore + list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings"} # type: ignore @distributed_trace_async async def get( @@ -171,17 +190,19 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AdaptiveNetworkHardening] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardening] - request = build_get_request( resource_group_name=resource_group_name, resource_namespace=resource_namespace, @@ -190,7 +211,7 @@ async def get( adaptive_network_hardening_resource_name=adaptive_network_hardening_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -198,9 +219,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -209,15 +228,14 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AdaptiveNetworkHardening', pipeline_response) + deserialized = self._deserialize("AdaptiveNetworkHardening", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}"} # type: ignore async def _enforce_initial( # pylint: disable=inconsistent-return-statements self, @@ -230,17 +248,22 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop('adaptive_network_hardening_enforce_action', "enforce") # type: str - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] + adaptive_network_hardening_enforce_action = kwargs.pop( + "adaptive_network_hardening_enforce_action", "enforce" + ) # type: Literal["enforce"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] content_type = content_type or "application/json" _json = None @@ -248,7 +271,7 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements if isinstance(body, (IO, bytes)): _content = body else: - _json = self._serialize.body(body, 'AdaptiveNetworkHardeningEnforceRequest') + _json = self._serialize.body(body, "AdaptiveNetworkHardeningEnforceRequest") request = build_enforce_request( resource_group_name=resource_group_name, @@ -262,7 +285,7 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._enforce_initial.metadata['url'], + template_url=self._enforce_initial.metadata["url"], headers=_headers, params=_params, ) @@ -270,9 +293,7 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -284,8 +305,7 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _enforce_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore - + _enforce_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore @overload async def begin_enforce( @@ -385,7 +405,6 @@ async def begin_enforce( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async async def begin_enforce( self, @@ -436,16 +455,15 @@ async def begin_enforce( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - adaptive_network_hardening_enforce_action = kwargs.pop('adaptive_network_hardening_enforce_action', "enforce") # type: str - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + adaptive_network_hardening_enforce_action = kwargs.pop( + "adaptive_network_hardening_enforce_action", "enforce" + ) # type: Literal["enforce"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._enforce_initial( # type: ignore resource_group_name=resource_group_name, @@ -457,34 +475,30 @@ async def begin_enforce( adaptive_network_hardening_enforce_action=adaptive_network_hardening_enforce_action, api_version=api_version, content_type=content_type, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_enforce.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore + begin_enforce.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py index 1bbcf7642e24..cb341ce95ec9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._allowed_connections_operations import build_get_request, build_list_by_home_region_request, build_list_request -T = TypeVar('T') +from ...operations._allowed_connections_operations import ( + build_get_request, + build_list_by_home_region_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AllowedConnectionsOperations: """ .. warning:: @@ -44,12 +62,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.AllowedConnectionsResource"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.AllowedConnectionsResource"]: """Gets the list of all possible traffic between resources for the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,20 +76,24 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AllowedConnectionsList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -84,10 +102,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -104,9 +129,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,17 +139,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections"} # type: ignore @distributed_trace def list_by_home_region( - self, - asc_location: str, - **kwargs: Any + self, asc_location: str, **kwargs: Any ) -> AsyncIterable["_models.AllowedConnectionsResource"]: """Gets the list of all possible traffic between resources for the subscription and location. @@ -143,21 +162,25 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AllowedConnectionsList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_home_region_request( asc_location=asc_location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_home_region.metadata['url'], + template_url=self.list_by_home_region.metadata["url"], headers=_headers, params=_params, ) @@ -166,10 +189,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -186,9 +216,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -198,18 +226,16 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_home_region.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections"} # type: ignore + list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections"} # type: ignore @distributed_trace_async async def get( self, resource_group_name: str, asc_location: str, - connection_type: Union[str, "_models.ConnectionType"], + connection_type: Union[str, _models.ConnectionType], **kwargs: Any ) -> _models.AllowedConnectionsResource: """Gets the list of all possible traffic between resources for the subscription and location, @@ -230,24 +256,26 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.AllowedConnectionsResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsResource] - request = build_get_request( resource_group_name=resource_group_name, asc_location=asc_location, connection_type=connection_type, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -255,9 +283,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -266,12 +292,11 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('AllowedConnectionsResource', pipeline_response) + deserialized = self._deserialize("AllowedConnectionsResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py index 3dd61c6048f0..e6ac957eedaa 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,10 +29,23 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._assessments_metadata_operations import build_create_in_subscription_request, build_delete_in_subscription_request, build_get_in_subscription_request, build_get_request, build_list_by_subscription_request, build_list_request -T = TypeVar('T') +from ...operations._assessments_metadata_operations import ( + build_create_in_subscription_request, + build_delete_in_subscription_request, + build_get_in_subscription_request, + build_get_request, + build_list_by_subscription_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AssessmentsMetadataOperations: """ .. warning:: @@ -44,12 +65,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.SecurityAssessmentMetadata"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetadata"]: """Get metadata information on all assessment types. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,19 +79,23 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityAssessmentMetadataList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,10 +104,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,9 +131,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,18 +141,12 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata"} # type: ignore @distributed_trace_async - async def get( - self, - assessment_metadata_name: str, - **kwargs: Any - ) -> _models.SecurityAssessmentMetadata: + async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityAssessmentMetadata: """Get metadata information on an assessment type. :param assessment_metadata_name: The Assessment Key - Unique key for the assessment type. @@ -138,21 +158,23 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] - request = build_get_request( assessment_metadata_name=assessment_metadata_name, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,9 +182,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -171,21 +191,17 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessmentMetadata', pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore - + get.metadata = {"url": "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> AsyncIterable["_models.SecurityAssessmentMetadata"]: + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetadata"]: """Get metadata information on all assessment types in a specific subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -198,20 +214,24 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityAssessmentMetadataList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], + template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) @@ -220,10 +240,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -240,9 +267,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -252,17 +277,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata"} # type: ignore @distributed_trace_async async def get_in_subscription( - self, - assessment_metadata_name: str, - **kwargs: Any + self, assessment_metadata_name: str, **kwargs: Any ) -> _models.SecurityAssessmentMetadata: """Get metadata information on an assessment type in a specific subscription. @@ -275,22 +296,24 @@ async def get_in_subscription( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] - request = build_get_in_subscription_request( assessment_metadata_name=assessment_metadata_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_in_subscription.metadata['url'], + template_url=self.get_in_subscription.metadata["url"], headers=_headers, params=_params, ) @@ -298,9 +321,7 @@ async def get_in_subscription( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -309,15 +330,14 @@ async def get_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessmentMetadata', pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get_in_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore - + get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore @overload async def create_in_subscription( @@ -369,7 +389,6 @@ async def create_in_subscription( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async async def create_in_subscription( self, @@ -395,16 +414,19 @@ async def create_in_subscription( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityAssessmentMetadata] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] content_type = content_type or "application/json" _json = None @@ -412,7 +434,7 @@ async def create_in_subscription( if isinstance(assessment_metadata, (IO, bytes)): _content = assessment_metadata else: - _json = self._serialize.body(assessment_metadata, 'SecurityAssessmentMetadata') + _json = self._serialize.body(assessment_metadata, "SecurityAssessmentMetadata") request = build_create_in_subscription_request( assessment_metadata_name=assessment_metadata_name, @@ -421,7 +443,7 @@ async def create_in_subscription( content_type=content_type, json=_json, content=_content, - template_url=self.create_in_subscription.metadata['url'], + template_url=self.create_in_subscription.metadata["url"], headers=_headers, params=_params, ) @@ -429,9 +451,7 @@ async def create_in_subscription( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -440,21 +460,18 @@ async def create_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessmentMetadata', pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_in_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore - + create_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore @distributed_trace_async async def delete_in_subscription( # pylint: disable=inconsistent-return-statements - self, - assessment_metadata_name: str, - **kwargs: Any + self, assessment_metadata_name: str, **kwargs: Any ) -> None: """Delete metadata information on an assessment type in a specific subscription, will cause the deletion of all the assessments of that type in that subscription. @@ -468,22 +485,24 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_in_subscription_request( assessment_metadata_name=assessment_metadata_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete_in_subscription.metadata['url'], + template_url=self.delete_in_subscription.metadata["url"], headers=_headers, params=_params, ) @@ -491,9 +510,7 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -505,5 +522,4 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - delete_in_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore - + delete_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py index 0de36619a20d..1761db658ea4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._assessments_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._assessments_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class AssessmentsOperations: """ .. warning:: @@ -44,13 +63,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - scope: str, - **kwargs: Any - ) -> AsyncIterable["_models.SecurityAssessment"]: + def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessment"]: """Get security assessments on all your scanned resources inside a scope. :param scope: Scope of the query, can be subscription @@ -66,20 +80,24 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityAssessmentList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( scope=scope, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -88,10 +106,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -108,9 +133,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -120,18 +143,16 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/{scope}/providers/Microsoft.Security/assessments"} # type: ignore + list.metadata = {"url": "/{scope}/providers/Microsoft.Security/assessments"} # type: ignore @distributed_trace_async async def get( self, resource_id: str, assessment_name: str, - expand: Optional[Union[str, "_models.ExpandEnum"]] = None, + expand: Optional[Union[str, _models.ExpandEnum]] = None, **kwargs: Any ) -> _models.SecurityAssessment: """Get a security assessment on your scanned resource. @@ -149,23 +170,25 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityAssessment] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] - request = build_get_request( resource_id=resource_id, assessment_name=assessment_name, expand=expand, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -173,9 +196,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -184,15 +205,14 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecurityAssessment', pipeline_response) + deserialized = self._deserialize("SecurityAssessment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore - + get.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore @overload async def create_or_update( @@ -250,14 +270,9 @@ async def create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async async def create_or_update( - self, - resource_id: str, - assessment_name: str, - assessment: Union[_models.SecurityAssessment, IO], - **kwargs: Any + self, resource_id: str, assessment_name: str, assessment: Union[_models.SecurityAssessment, IO], **kwargs: Any ) -> _models.SecurityAssessment: """Create a security assessment on your resource. An assessment metadata that describes this assessment must be predefined with the same name before inserting the assessment result. @@ -278,16 +293,19 @@ async def create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecurityAssessment] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] content_type = content_type or "application/json" _json = None @@ -295,7 +313,7 @@ async def create_or_update( if isinstance(assessment, (IO, bytes)): _content = assessment else: - _json = self._serialize.body(assessment, 'SecurityAssessment') + _json = self._serialize.body(assessment, "SecurityAssessment") request = build_create_or_update_request( resource_id=resource_id, @@ -304,7 +322,7 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata['url'], + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -312,9 +330,7 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -324,25 +340,21 @@ async def create_or_update( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('SecurityAssessment', pipeline_response) + deserialized = self._deserialize("SecurityAssessment", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize('SecurityAssessment', pipeline_response) + deserialized = self._deserialize("SecurityAssessment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore - + create_or_update.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_id: str, - assessment_name: str, - **kwargs: Any + self, resource_id: str, assessment_name: str, **kwargs: Any ) -> None: """Delete a security assessment on your resource. An assessment metadata that describes this assessment must be predefined with the same name before inserting the assessment result. @@ -357,22 +369,24 @@ async def delete( # pylint: disable=inconsistent-return-statements :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( resource_id=resource_id, assessment_name=assessment_name, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -380,9 +394,7 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -394,5 +406,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore - + delete.metadata = {"url": "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py index 0263981579d4..48d2baa9aead 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._discovered_security_solutions_operations import build_get_request, build_list_by_home_region_request, build_list_request -T = TypeVar('T') +from ...operations._discovered_security_solutions_operations import ( + build_get_request, + build_list_by_home_region_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class DiscoveredSecuritySolutionsOperations: """ .. warning:: @@ -44,12 +62,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.DiscoveredSecuritySolution"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.DiscoveredSecuritySolution"]: """Gets a list of discovered Security Solutions for the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,20 +76,24 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DiscoveredSecuritySolutionList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -84,10 +102,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -104,9 +129,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,17 +139,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions"} # type: ignore @distributed_trace def list_by_home_region( - self, - asc_location: str, - **kwargs: Any + self, asc_location: str, **kwargs: Any ) -> AsyncIterable["_models.DiscoveredSecuritySolution"]: """Gets a list of discovered Security Solutions for the subscription and location. @@ -143,21 +162,25 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DiscoveredSecuritySolutionList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_home_region_request( asc_location=asc_location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_home_region.metadata['url'], + template_url=self.list_by_home_region.metadata["url"], headers=_headers, params=_params, ) @@ -166,10 +189,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -186,9 +216,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -198,19 +226,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_home_region.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions"} # type: ignore + list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - asc_location: str, - discovered_security_solution_name: str, - **kwargs: Any + self, resource_group_name: str, asc_location: str, discovered_security_solution_name: str, **kwargs: Any ) -> _models.DiscoveredSecuritySolution: """Gets a specific discovered Security Solution. @@ -228,24 +250,26 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.DiscoveredSecuritySolution] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolution] - request = build_get_request( resource_group_name=resource_group_name, asc_location=asc_location, discovered_security_solution_name=discovered_security_solution_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -253,9 +277,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -264,12 +286,11 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('DiscoveredSecuritySolution', pipeline_response) + deserialized = self._deserialize("DiscoveredSecuritySolution", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py index 6eaf733532d9..180037abff08 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,10 +29,20 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._external_security_solutions_operations import build_get_request, build_list_by_home_region_request, build_list_request -T = TypeVar('T') +from ...operations._external_security_solutions_operations import ( + build_get_request, + build_list_by_home_region_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ExternalSecuritySolutionsOperations: """ .. warning:: @@ -44,12 +62,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ExternalSecuritySolution"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ExternalSecuritySolution"]: """Gets a list of external security solutions for the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,20 +76,24 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ExternalSecuritySolutionList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -84,10 +102,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -104,9 +129,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,17 +139,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions"} # type: ignore @distributed_trace def list_by_home_region( - self, - asc_location: str, - **kwargs: Any + self, asc_location: str, **kwargs: Any ) -> AsyncIterable["_models.ExternalSecuritySolution"]: """Gets a list of external Security Solutions for the subscription and location. @@ -143,21 +162,25 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ExternalSecuritySolutionList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_home_region_request( asc_location=asc_location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_home_region.metadata['url'], + template_url=self.list_by_home_region.metadata["url"], headers=_headers, params=_params, ) @@ -166,10 +189,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -186,9 +216,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -198,19 +226,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_home_region.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions"} # type: ignore + list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - asc_location: str, - external_security_solutions_name: str, - **kwargs: Any + self, resource_group_name: str, asc_location: str, external_security_solutions_name: str, **kwargs: Any ) -> _models.ExternalSecuritySolution: """Gets a specific external Security Solution. @@ -228,24 +250,26 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ExternalSecuritySolution] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolution] - request = build_get_request( resource_group_name=resource_group_name, asc_location=asc_location, external_security_solutions_name=external_security_solutions_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -253,9 +277,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -264,12 +286,11 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ExternalSecuritySolution', pipeline_response) + deserialized = self._deserialize("ExternalSecuritySolution", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py index 127b7b4b143c..d5a6f0671157 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,10 +29,25 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._jit_network_access_policies_operations import build_create_or_update_request, build_delete_request, build_get_request, build_initiate_request, build_list_by_region_request, build_list_by_resource_group_and_region_request, build_list_by_resource_group_request, build_list_request -T = TypeVar('T') +from ...operations._jit_network_access_policies_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_initiate_request, + build_list_by_region_request, + build_list_by_resource_group_and_region_request, + build_list_by_resource_group_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class JitNetworkAccessPoliciesOperations: """ .. warning:: @@ -44,12 +67,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.JitNetworkAccessPolicy"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.JitNetworkAccessPolicy"]: """Policies for protecting resources using Just-in-Time access control. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,20 +81,24 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -84,10 +107,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -104,9 +134,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,18 +144,12 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore @distributed_trace - def list_by_region( - self, - asc_location: str, - **kwargs: Any - ) -> AsyncIterable["_models.JitNetworkAccessPolicy"]: + def list_by_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_models.JitNetworkAccessPolicy"]: """Policies for protecting resources using Just-in-Time access control for the subscription, location. @@ -144,21 +166,25 @@ def list_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_region_request( asc_location=asc_location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_region.metadata['url'], + template_url=self.list_by_region.metadata["url"], headers=_headers, params=_params, ) @@ -167,10 +193,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -187,9 +220,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -199,17 +230,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_region.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore + list_by_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore @distributed_trace def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any + self, resource_group_name: str, **kwargs: Any ) -> AsyncIterable["_models.JitNetworkAccessPolicy"]: """Policies for protecting resources using Just-in-Time access control for the subscription, location. @@ -227,21 +254,25 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata['url'], + template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) @@ -250,10 +281,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -270,9 +308,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -282,18 +318,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies"} # type: ignore @distributed_trace def list_by_resource_group_and_region( - self, - resource_group_name: str, - asc_location: str, - **kwargs: Any + self, resource_group_name: str, asc_location: str, **kwargs: Any ) -> AsyncIterable["_models.JitNetworkAccessPolicy"]: """Policies for protecting resources using Just-in-Time access control for the subscription, location. @@ -314,22 +345,26 @@ def list_by_resource_group_and_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.JitNetworkAccessPoliciesList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_resource_group_and_region_request( resource_group_name=resource_group_name, asc_location=asc_location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group_and_region.metadata['url'], + template_url=self.list_by_resource_group_and_region.metadata["url"], headers=_headers, params=_params, ) @@ -338,10 +373,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -358,9 +400,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -370,19 +410,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group_and_region.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore + list_by_resource_group_and_region.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - asc_location: str, - jit_network_access_policy_name: str, - **kwargs: Any + self, resource_group_name: str, asc_location: str, jit_network_access_policy_name: str, **kwargs: Any ) -> _models.JitNetworkAccessPolicy: """Policies for protecting resources using Just-in-Time access control for the subscription, location. @@ -402,24 +436,26 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.JitNetworkAccessPolicy] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] - request = build_get_request( resource_group_name=resource_group_name, asc_location=asc_location, jit_network_access_policy_name=jit_network_access_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -427,9 +463,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -438,15 +472,14 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('JitNetworkAccessPolicy', pipeline_response) + deserialized = self._deserialize("JitNetworkAccessPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore @overload async def create_or_update( @@ -514,7 +547,6 @@ async def create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async async def create_or_update( self, @@ -546,16 +578,19 @@ async def create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.JitNetworkAccessPolicy] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] content_type = content_type or "application/json" _json = None @@ -563,7 +598,7 @@ async def create_or_update( if isinstance(body, (IO, bytes)): _content = body else: - _json = self._serialize.body(body, 'JitNetworkAccessPolicy') + _json = self._serialize.body(body, "JitNetworkAccessPolicy") request = build_create_or_update_request( resource_group_name=resource_group_name, @@ -574,7 +609,7 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata['url'], + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -582,9 +617,7 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -593,23 +626,18 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('JitNetworkAccessPolicy', pipeline_response) + deserialized = self._deserialize("JitNetworkAccessPolicy", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - asc_location: str, - jit_network_access_policy_name: str, - **kwargs: Any + self, resource_group_name: str, asc_location: str, jit_network_access_policy_name: str, **kwargs: Any ) -> None: """Delete a Just-in-Time access control policy. @@ -628,24 +656,26 @@ async def delete( # pylint: disable=inconsistent-return-statements :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( resource_group_name=resource_group_name, asc_location=asc_location, jit_network_access_policy_name=jit_network_access_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -653,9 +683,7 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -667,8 +695,7 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}"} # type: ignore @overload async def initiate( @@ -744,7 +771,6 @@ async def initiate( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async async def initiate( self, @@ -780,17 +806,22 @@ async def initiate( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - jit_network_access_policy_initiate_type = kwargs.pop('jit_network_access_policy_initiate_type', "initiate") # type: str - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.JitNetworkAccessRequest] + jit_network_access_policy_initiate_type = kwargs.pop( + "jit_network_access_policy_initiate_type", "initiate" + ) # type: Literal["initiate"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessRequest] content_type = content_type or "application/json" _json = None @@ -798,7 +829,7 @@ async def initiate( if isinstance(body, (IO, bytes)): _content = body else: - _json = self._serialize.body(body, 'JitNetworkAccessPolicyInitiateRequest') + _json = self._serialize.body(body, "JitNetworkAccessPolicyInitiateRequest") request = build_initiate_request( resource_group_name=resource_group_name, @@ -810,7 +841,7 @@ async def initiate( content_type=content_type, json=_json, content=_content, - template_url=self.initiate.metadata['url'], + template_url=self.initiate.metadata["url"], headers=_headers, params=_params, ) @@ -818,9 +849,7 @@ async def initiate( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -829,12 +858,11 @@ async def initiate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('JitNetworkAccessRequest', pipeline_response) + deserialized = self._deserialize("JitNetworkAccessRequest", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - initiate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}"} # type: ignore - + initiate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __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. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py index 09e4ee7643bc..1666c3f2a99e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -20,10 +28,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._secure_score_control_definitions_operations import build_list_by_subscription_request, build_list_request -T = TypeVar('T') +from ...operations._secure_score_control_definitions_operations import ( + build_list_by_subscription_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SecureScoreControlDefinitionsOperations: """ .. warning:: @@ -43,12 +60,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.SecureScoreControlDefinitionItem"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreControlDefinitionItem"]: """List the available security controls, their assessments, and the max score. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,19 +74,23 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecureScoreControlDefinitionList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_request( api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -82,10 +99,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -102,9 +126,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -114,17 +136,12 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> AsyncIterable["_models.SecureScoreControlDefinitionItem"]: + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreControlDefinitionItem"]: """For a specified subscription, list the available security controls, their assessments, and the max score. @@ -138,20 +155,24 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecureScoreControlDefinitionList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], + template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) @@ -160,10 +181,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -180,9 +208,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -192,8 +218,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py index 11b70f0f3e80..d935cbe380ac 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,9 +29,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._secure_score_controls_operations import build_list_by_secure_score_request, build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SecureScoreControlsOperations: """ .. warning:: @@ -43,13 +57,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace def list_by_secure_score( - self, - secure_score_name: str, - expand: Optional[Union[str, "_models.ExpandControlsEnum"]] = None, - **kwargs: Any + self, secure_score_name: str, expand: Optional[Union[str, _models.ExpandControlsEnum]] = None, **kwargs: Any ) -> AsyncIterable["_models.SecureScoreControlDetails"]: """Get all security controls for a specific initiative within a scope. @@ -68,22 +78,26 @@ def list_by_secure_score( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecureScoreControlList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_secure_score_request( secure_score_name=secure_score_name, subscription_id=self._config.subscription_id, expand=expand, api_version=api_version, - template_url=self.list_by_secure_score.metadata['url'], + template_url=self.list_by_secure_score.metadata["url"], headers=_headers, params=_params, ) @@ -92,10 +106,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -112,9 +133,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -124,17 +143,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_secure_score.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls"} # type: ignore + list_by_secure_score.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls"} # type: ignore @distributed_trace def list( - self, - expand: Optional[Union[str, "_models.ExpandControlsEnum"]] = None, - **kwargs: Any + self, expand: Optional[Union[str, _models.ExpandControlsEnum]] = None, **kwargs: Any ) -> AsyncIterable["_models.SecureScoreControlDetails"]: """Get all security controls within a scope. @@ -150,21 +165,25 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecureScoreControlList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, expand=expand, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -173,10 +192,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -193,9 +219,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -205,8 +229,6 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControls"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py index ff02b070d169..c4821406dd76 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -22,9 +30,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._secure_scores_operations import build_get_request, build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SecureScoresOperations: """ .. warning:: @@ -44,12 +58,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.SecureScoreItem"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreItem"]: """List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. @@ -62,20 +72,24 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecureScoresList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoresList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -84,10 +98,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -104,9 +125,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -116,18 +135,12 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores"} # type: ignore @distributed_trace_async - async def get( - self, - secure_score_name: str, - **kwargs: Any - ) -> _models.SecureScoreItem: + async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: """Get secure score for a specific Microsoft Defender for Cloud initiative within your current scope. For the ASC Default initiative, use 'ascScore'. @@ -140,22 +153,24 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecureScoreItem] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreItem] - request = build_get_request( secure_score_name=secure_score_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -163,9 +178,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -174,12 +187,11 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecureScoreItem', pipeline_response) + deserialized = self._deserialize("SecureScoreItem", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py index e41e91e22dc0..dd8c2bd37cad 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -22,9 +30,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._security_solutions_operations import build_get_request, build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SecuritySolutionsOperations: """ .. warning:: @@ -44,12 +58,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.SecuritySolution"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.SecuritySolution"]: """Gets a list of Security Solutions for the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,20 +71,24 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecuritySolutionList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,10 +97,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,9 +124,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,19 +134,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - asc_location: str, - security_solution_name: str, - **kwargs: Any + self, resource_group_name: str, asc_location: str, security_solution_name: str, **kwargs: Any ) -> _models.SecuritySolution: """Gets a specific Security Solution. @@ -145,24 +158,26 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecuritySolution] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolution] - request = build_get_request( resource_group_name=resource_group_name, asc_location=asc_location, security_solution_name=security_solution_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -170,9 +185,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -181,12 +194,11 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecuritySolution', pipeline_response) + deserialized = self._deserialize("SecuritySolution", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py index 2f61757b1815..5e79c73762c7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py @@ -6,9 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -18,10 +26,19 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._security_solutions_reference_data_operations import build_list_by_home_region_request, build_list_request -T = TypeVar('T') +from ...operations._security_solutions_reference_data_operations import ( + build_list_by_home_region_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SecuritySolutionsReferenceDataOperations: """ .. warning:: @@ -41,12 +58,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def list( - self, - **kwargs: Any - ) -> _models.SecuritySolutionsReferenceDataList: + async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: """Gets a list of all supported Security Solutions for the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -55,21 +68,23 @@ async def list( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] - request = build_list_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -77,9 +92,7 @@ async def list( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -88,22 +101,17 @@ async def list( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecuritySolutionsReferenceDataList', pipeline_response) + deserialized = self._deserialize("SecuritySolutionsReferenceDataList", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData"} # type: ignore - + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData"} # type: ignore @distributed_trace_async - async def list_by_home_region( - self, - asc_location: str, - **kwargs: Any - ) -> _models.SecuritySolutionsReferenceDataList: + async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: """Gets list of all supported Security Solutions for subscription and location. :param asc_location: The location where ASC stores the data of the subscription. can be @@ -115,22 +123,24 @@ async def list_by_home_region( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] - request = build_list_by_home_region_request( asc_location=asc_location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_home_region.metadata['url'], + template_url=self.list_by_home_region.metadata["url"], headers=_headers, params=_params, ) @@ -138,9 +148,7 @@ async def list_by_home_region( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -149,12 +157,11 @@ async def list_by_home_region( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('SecuritySolutionsReferenceDataList', pipeline_response) + deserialized = self._deserialize("SecuritySolutionsReferenceDataList", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_by_home_region.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData"} # type: ignore - + list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py index 6a978f394a08..3b7016783df2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py @@ -6,9 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, map_error +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod @@ -20,10 +28,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._server_vulnerability_assessment_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_extended_resource_request -T = TypeVar('T') +from ...operations._server_vulnerability_assessment_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_extended_resource_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ServerVulnerabilityAssessmentOperations: """ .. warning:: @@ -43,15 +62,9 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async async def list_by_extended_resource( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any ) -> _models.ServerVulnerabilityAssessmentsList: """Gets a list of server vulnerability assessment onboarding statuses on a given resource. @@ -70,17 +83,19 @@ async def list_by_extended_resource( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ServerVulnerabilityAssessmentsList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessmentsList] - request = build_list_by_extended_resource_request( resource_group_name=resource_group_name, resource_namespace=resource_namespace, @@ -88,7 +103,7 @@ async def list_by_extended_resource( resource_name=resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_extended_resource.metadata['url'], + template_url=self.list_by_extended_resource.metadata["url"], headers=_headers, params=_params, ) @@ -96,9 +111,7 @@ async def list_by_extended_resource( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -107,24 +120,18 @@ async def list_by_extended_resource( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ServerVulnerabilityAssessmentsList', pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessmentsList", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - list_by_extended_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments"} # type: ignore - + list_by_extended_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any ) -> _models.ServerVulnerabilityAssessment: """Gets a server vulnerability assessment onboarding statuses on a given resource. @@ -147,18 +154,22 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop('server_vulnerability_assessment', "default") # type: str - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ServerVulnerabilityAssessment] + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] - request = build_get_request( resource_group_name=resource_group_name, resource_namespace=resource_namespace, @@ -167,7 +178,7 @@ async def get( subscription_id=self._config.subscription_id, server_vulnerability_assessment=server_vulnerability_assessment, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -175,9 +186,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -186,24 +195,18 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ServerVulnerabilityAssessment', pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore @distributed_trace_async async def create_or_update( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any ) -> _models.ServerVulnerabilityAssessment: """Creating a server vulnerability assessment on a resource, which will onboard a resource for having a vulnerability assessment on it. @@ -227,18 +230,22 @@ async def create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop('server_vulnerability_assessment', "default") # type: str - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ServerVulnerabilityAssessment] + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] - request = build_create_or_update_request( resource_group_name=resource_group_name, resource_namespace=resource_namespace, @@ -247,7 +254,7 @@ async def create_or_update( subscription_id=self._config.subscription_id, server_vulnerability_assessment=server_vulnerability_assessment, api_version=api_version, - template_url=self.create_or_update.metadata['url'], + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -255,9 +262,7 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -266,37 +271,35 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ServerVulnerabilityAssessment', pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessment", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any ) -> None: error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop('server_vulnerability_assessment', "default") # type: str - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( resource_group_name=resource_group_name, resource_namespace=resource_namespace, @@ -305,7 +308,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, server_vulnerability_assessment=server_vulnerability_assessment, api_version=api_version, - template_url=self._delete_initial.metadata['url'], + template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) @@ -313,9 +316,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -327,17 +328,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore - + _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore @distributed_trace_async async def begin_delete( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - **kwargs: Any + self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: """Removing server vulnerability assessment from a resource. @@ -369,15 +364,14 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop('server_vulnerability_assessment', "default") # type: str - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[None] + polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -386,34 +380,32 @@ async def begin_delete( resource_name=resource_name, server_vulnerability_assessment=server_vulnerability_assessment, api_version=api_version, - cls=lambda x,y,z: x, + cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) - kwargs.pop('error_map', None) + kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling( - lro_delay, - lro_options={'final-state-via': 'location'}, - - **kwargs - )) # type: AsyncPollingMethod - elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: polling_method = polling + polling_method = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) # type: AsyncPollingMethod + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, - deserialization_callback=get_long_running_output + deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore + begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py index 7996a058582c..8568c81fb33c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -22,9 +30,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._topology_operations import build_get_request, build_list_by_home_region_request, build_list_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class TopologyOperations: """ .. warning:: @@ -44,12 +58,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.TopologyResource"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.TopologyResource"]: """Gets a list that allows to build a topology view of a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,20 +71,24 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TopologyList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,10 +97,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,9 +124,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,18 +134,12 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies"} # type: ignore @distributed_trace - def list_by_home_region( - self, - asc_location: str, - **kwargs: Any - ) -> AsyncIterable["_models.TopologyResource"]: + def list_by_home_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_models.TopologyResource"]: """Gets a list that allows to build a topology view of a subscription and location. :param asc_location: The location where ASC stores the data of the subscription. can be @@ -141,21 +154,25 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TopologyList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) + def prepare_request(next_link=None): if not next_link: - + request = build_list_by_home_region_request( asc_location=asc_location, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_home_region.metadata['url'], + template_url=self.list_by_home_region.metadata["url"], headers=_headers, params=_params, ) @@ -164,10 +181,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -184,9 +208,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -196,19 +218,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list_by_home_region.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies"} # type: ignore + list_by_home_region.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies"} # type: ignore @distributed_trace_async async def get( - self, - resource_group_name: str, - asc_location: str, - topology_resource_name: str, - **kwargs: Any + self, resource_group_name: str, asc_location: str, topology_resource_name: str, **kwargs: Any ) -> _models.TopologyResource: """Gets a specific topology component. @@ -226,24 +242,26 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.TopologyResource] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyResource] - request = build_get_request( resource_group_name=resource_group_name, asc_location=asc_location, topology_resource_name=topology_resource_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -251,9 +269,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -262,12 +278,11 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('TopologyResource', pipeline_response) + deserialized = self._deserialize("TopologyResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py index 04e9256c865f..22cb443808b0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py @@ -120,117 +120,118 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AadConnectivityState', - 'AadExternalSecuritySolution', - 'AadSolutionProperties', - 'AdaptiveApplicationControlGroup', - 'AdaptiveApplicationControlGroups', - 'AdaptiveApplicationControlIssueSummary', - 'AdaptiveNetworkHardening', - 'AdaptiveNetworkHardeningEnforceRequest', - 'AdaptiveNetworkHardeningsList', - 'AllowedConnectionsList', - 'AllowedConnectionsResource', - 'AssessmentLinks', - 'AssessmentStatus', - 'AtaExternalSecuritySolution', - 'AtaSolutionProperties', - 'AzureResourceDetails', - 'AzureResourceLink', - 'CefExternalSecuritySolution', - 'CefSolutionProperties', - 'CloudErrorBody', - 'ConnectableResource', - 'ConnectedResource', - 'ConnectedWorkspace', - 'DiscoveredSecuritySolution', - 'DiscoveredSecuritySolutionList', - 'EffectiveNetworkSecurityGroups', - 'ErrorAdditionalInfo', - 'ExternalSecuritySolution', - 'ExternalSecuritySolutionKind', - 'ExternalSecuritySolutionList', - 'ExternalSecuritySolutionProperties', - 'JitNetworkAccessPoliciesList', - 'JitNetworkAccessPolicy', - 'JitNetworkAccessPolicyInitiatePort', - 'JitNetworkAccessPolicyInitiateRequest', - 'JitNetworkAccessPolicyInitiateVirtualMachine', - 'JitNetworkAccessPolicyVirtualMachine', - 'JitNetworkAccessPortRule', - 'JitNetworkAccessRequest', - 'JitNetworkAccessRequestPort', - 'JitNetworkAccessRequestVirtualMachine', - 'Kind', - 'Location', - 'OnPremiseResourceDetails', - 'OnPremiseSqlResourceDetails', - 'PathRecommendation', - 'ProtectionMode', - 'PublisherInfo', - 'Resource', - 'ResourceDetails', - 'Rule', - 'SecureScoreControlDefinitionItem', - 'SecureScoreControlDefinitionList', - 'SecureScoreControlDefinitionSource', - 'SecureScoreControlDetails', - 'SecureScoreControlList', - 'SecureScoreControlScore', - 'SecureScoreItem', - 'SecureScoresList', - 'SecurityAssessment', - 'SecurityAssessmentList', - 'SecurityAssessmentMetadata', - 'SecurityAssessmentMetadataList', - 'SecurityAssessmentMetadataPartnerData', - 'SecurityAssessmentMetadataProperties', - 'SecurityAssessmentPartnerData', - 'SecuritySolution', - 'SecuritySolutionList', - 'SecuritySolutionsReferenceData', - 'SecuritySolutionsReferenceDataList', - 'ServerVulnerabilityAssessment', - 'ServerVulnerabilityAssessmentsList', - 'TopologyList', - 'TopologyResource', - 'TopologySingleResource', - 'TopologySingleResourceChild', - 'TopologySingleResourceParent', - 'UserRecommendation', - 'VmRecommendation', - 'AadConnectivityStateEnum', - 'AdaptiveApplicationControlIssue', - 'AssessmentStatusCode', - 'AssessmentType', - 'Categories', - 'ConfigurationStatus', - 'ConnectionType', - 'ControlType', - 'Direction', - 'EnforcementMode', - 'EnforcementSupport', - 'ExpandControlsEnum', - 'ExpandEnum', - 'ExternalSecuritySolutionKindEnum', - 'FileType', - 'ImplementationEffort', - 'ProtocolEnum', - 'ProvisioningState', - 'RecommendationAction', - 'RecommendationStatus', - 'RecommendationType', - 'SecurityFamily', - 'ServerVulnerabilityAssessmentPropertiesProvisioningState', - 'Severity', - 'Source', - 'SourceSystem', - 'Status', - 'StatusReason', - 'Threats', - 'TransportProtocol', - 'UserImpact', + "AadConnectivityState", + "AadExternalSecuritySolution", + "AadSolutionProperties", + "AdaptiveApplicationControlGroup", + "AdaptiveApplicationControlGroups", + "AdaptiveApplicationControlIssueSummary", + "AdaptiveNetworkHardening", + "AdaptiveNetworkHardeningEnforceRequest", + "AdaptiveNetworkHardeningsList", + "AllowedConnectionsList", + "AllowedConnectionsResource", + "AssessmentLinks", + "AssessmentStatus", + "AtaExternalSecuritySolution", + "AtaSolutionProperties", + "AzureResourceDetails", + "AzureResourceLink", + "CefExternalSecuritySolution", + "CefSolutionProperties", + "CloudErrorBody", + "ConnectableResource", + "ConnectedResource", + "ConnectedWorkspace", + "DiscoveredSecuritySolution", + "DiscoveredSecuritySolutionList", + "EffectiveNetworkSecurityGroups", + "ErrorAdditionalInfo", + "ExternalSecuritySolution", + "ExternalSecuritySolutionKind", + "ExternalSecuritySolutionList", + "ExternalSecuritySolutionProperties", + "JitNetworkAccessPoliciesList", + "JitNetworkAccessPolicy", + "JitNetworkAccessPolicyInitiatePort", + "JitNetworkAccessPolicyInitiateRequest", + "JitNetworkAccessPolicyInitiateVirtualMachine", + "JitNetworkAccessPolicyVirtualMachine", + "JitNetworkAccessPortRule", + "JitNetworkAccessRequest", + "JitNetworkAccessRequestPort", + "JitNetworkAccessRequestVirtualMachine", + "Kind", + "Location", + "OnPremiseResourceDetails", + "OnPremiseSqlResourceDetails", + "PathRecommendation", + "ProtectionMode", + "PublisherInfo", + "Resource", + "ResourceDetails", + "Rule", + "SecureScoreControlDefinitionItem", + "SecureScoreControlDefinitionList", + "SecureScoreControlDefinitionSource", + "SecureScoreControlDetails", + "SecureScoreControlList", + "SecureScoreControlScore", + "SecureScoreItem", + "SecureScoresList", + "SecurityAssessment", + "SecurityAssessmentList", + "SecurityAssessmentMetadata", + "SecurityAssessmentMetadataList", + "SecurityAssessmentMetadataPartnerData", + "SecurityAssessmentMetadataProperties", + "SecurityAssessmentPartnerData", + "SecuritySolution", + "SecuritySolutionList", + "SecuritySolutionsReferenceData", + "SecuritySolutionsReferenceDataList", + "ServerVulnerabilityAssessment", + "ServerVulnerabilityAssessmentsList", + "TopologyList", + "TopologyResource", + "TopologySingleResource", + "TopologySingleResourceChild", + "TopologySingleResourceParent", + "UserRecommendation", + "VmRecommendation", + "AadConnectivityStateEnum", + "AdaptiveApplicationControlIssue", + "AssessmentStatusCode", + "AssessmentType", + "Categories", + "ConfigurationStatus", + "ConnectionType", + "ControlType", + "Direction", + "EnforcementMode", + "EnforcementSupport", + "ExpandControlsEnum", + "ExpandEnum", + "ExternalSecuritySolutionKindEnum", + "FileType", + "ImplementationEffort", + "ProtocolEnum", + "ProvisioningState", + "RecommendationAction", + "RecommendationStatus", + "RecommendationType", + "SecurityFamily", + "ServerVulnerabilityAssessmentPropertiesProvisioningState", + "Severity", + "Source", + "SourceSystem", + "Status", + "StatusReason", + "Threats", + "TransportProtocol", + "UserImpact", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py index 358bbf9b07db..f912e7b9bdda 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py @@ -31,10 +31,7 @@ class AadConnectivityState(_serialization.Model): } def __init__( - self, - *, - connectivity_state: Optional[Union[str, "_models.AadConnectivityStateEnum"]] = None, - **kwargs + self, *, connectivity_state: Optional[Union[str, "_models.AadConnectivityStateEnum"]] = None, **kwargs ): """ :keyword connectivity_state: The connectivity state of the external AAD solution. Known values @@ -56,19 +53,15 @@ class Location(_serialization.Model): """ _validation = { - 'location': {'readonly': True}, + "location": {"readonly": True}, } _attribute_map = { "location": {"key": "location", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.location = None @@ -84,12 +77,7 @@ class ExternalSecuritySolutionKind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__( - self, - *, - kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, - **kwargs - ): + def __init__(self, *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, **kwargs): """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -113,9 +101,9 @@ class Resource(_serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { @@ -124,12 +112,8 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.id = None self.name = None @@ -154,10 +138,10 @@ class ExternalSecuritySolution(Resource, ExternalSecuritySolutionKind, Location) """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { @@ -168,12 +152,7 @@ class ExternalSecuritySolution(Resource, ExternalSecuritySolutionKind, Location) "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, - **kwargs - ): + def __init__(self, *, kind: Optional[Union[str, "_models.ExternalSecuritySolutionKindEnum"]] = None, **kwargs): """ :keyword kind: The kind of the external solution. Known values are: "CEF", "ATA", and "AAD". :paramtype kind: str or @@ -207,10 +186,10 @@ class AadExternalSecuritySolution(ExternalSecuritySolution): """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { @@ -339,7 +318,14 @@ def __init__( :keyword workspace: Represents an OMS workspace to which the solution is connected. :paramtype workspace: ~azure.mgmt.security.v2020_01_01.models.ConnectedWorkspace """ - super().__init__(additional_properties=additional_properties, device_vendor=device_vendor, device_type=device_type, workspace=workspace, connectivity_state=connectivity_state, **kwargs) + super().__init__( + additional_properties=additional_properties, + device_vendor=device_vendor, + device_type=device_type, + workspace=workspace, + connectivity_state=connectivity_state, + **kwargs + ) self.connectivity_state = connectivity_state self.additional_properties = additional_properties self.device_vendor = device_vendor @@ -387,14 +373,14 @@ class AdaptiveApplicationControlGroup(Resource, Location): # pylint: disable=to """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'configuration_status': {'readonly': True}, - 'recommendation_status': {'readonly': True}, - 'issues': {'readonly': True}, - 'source_system': {'readonly': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "configuration_status": {"readonly": True}, + "recommendation_status": {"readonly": True}, + "issues": {"readonly": True}, + "source_system": {"readonly": True}, } _attribute_map = { @@ -460,12 +446,7 @@ class AdaptiveApplicationControlGroups(_serialization.Model): "value": {"key": "value", "type": "[AdaptiveApplicationControlGroup]"}, } - def __init__( - self, - *, - value: Optional[List["_models.AdaptiveApplicationControlGroup"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.AdaptiveApplicationControlGroup"]] = None, **kwargs): """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup] @@ -533,9 +514,9 @@ class AdaptiveNetworkHardening(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { @@ -544,7 +525,10 @@ class AdaptiveNetworkHardening(Resource): "type": {"key": "type", "type": "str"}, "rules": {"key": "properties.rules", "type": "[Rule]"}, "rules_calculation_time": {"key": "properties.rulesCalculationTime", "type": "iso-8601"}, - "effective_network_security_groups": {"key": "properties.effectiveNetworkSecurityGroups", "type": "[EffectiveNetworkSecurityGroups]"}, + "effective_network_security_groups": { + "key": "properties.effectiveNetworkSecurityGroups", + "type": "[EffectiveNetworkSecurityGroups]", + }, } def __init__( @@ -585,8 +569,8 @@ class AdaptiveNetworkHardeningEnforceRequest(_serialization.Model): """ _validation = { - 'rules': {'required': True}, - 'network_security_groups': {'required': True}, + "rules": {"required": True}, + "network_security_groups": {"required": True}, } _attribute_map = { @@ -594,13 +578,7 @@ class AdaptiveNetworkHardeningEnforceRequest(_serialization.Model): "network_security_groups": {"key": "networkSecurityGroups", "type": "[str]"}, } - def __init__( - self, - *, - rules: List["_models.Rule"], - network_security_groups: List[str], - **kwargs - ): + def __init__(self, *, rules: List["_models.Rule"], network_security_groups: List[str], **kwargs): """ :keyword rules: The rules to enforce. Required. :paramtype rules: list[~azure.mgmt.security.v2020_01_01.models.Rule] @@ -658,8 +636,8 @@ class AllowedConnectionsList(_serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -667,12 +645,8 @@ class AllowedConnectionsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.value = None self.next_link = None @@ -700,12 +674,12 @@ class AllowedConnectionsResource(Resource, Location): """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'calculated_date_time': {'readonly': True}, - 'connectable_resources': {'readonly': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "calculated_date_time": {"readonly": True}, + "connectable_resources": {"readonly": True}, } _attribute_map = { @@ -717,12 +691,8 @@ class AllowedConnectionsResource(Resource, Location): "connectable_resources": {"key": "properties.connectableResources", "type": "[ConnectableResource]"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.location = None self.calculated_date_time = None @@ -742,19 +712,15 @@ class AssessmentLinks(_serialization.Model): """ _validation = { - 'azure_portal_uri': {'readonly': True}, + "azure_portal_uri": {"readonly": True}, } _attribute_map = { "azure_portal_uri": {"key": "azurePortalUri", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.azure_portal_uri = None @@ -774,7 +740,7 @@ class AssessmentStatus(_serialization.Model): """ _validation = { - 'code': {'required': True}, + "code": {"required": True}, } _attribute_map = { @@ -826,10 +792,10 @@ class AtaExternalSecuritySolution(ExternalSecuritySolution): """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { @@ -906,7 +872,13 @@ def __init__( :keyword last_event_received: :paramtype last_event_received: str """ - super().__init__(additional_properties=additional_properties, device_vendor=device_vendor, device_type=device_type, workspace=workspace, **kwargs) + super().__init__( + additional_properties=additional_properties, + device_vendor=device_vendor, + device_type=device_type, + workspace=workspace, + **kwargs + ) self.last_event_received = last_event_received @@ -924,23 +896,17 @@ class ResourceDetails(_serialization.Model): """ _validation = { - 'source': {'required': True}, + "source": {"required": True}, } _attribute_map = { "source": {"key": "source", "type": "str"}, } - _subtype_map = { - 'source': {'Azure': 'AzureResourceDetails', 'OnPremise': 'OnPremiseResourceDetails'} - } + _subtype_map = {"source": {"Azure": "AzureResourceDetails", "OnPremise": "OnPremiseResourceDetails"}} - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.source = None # type: Optional[str] @@ -960,8 +926,8 @@ class AzureResourceDetails(ResourceDetails): """ _validation = { - 'source': {'required': True}, - 'id': {'readonly': True}, + "source": {"required": True}, + "id": {"readonly": True}, } _attribute_map = { @@ -969,14 +935,10 @@ class AzureResourceDetails(ResourceDetails): "id": {"key": "id", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) - self.source = 'Azure' # type: str + self.source = "Azure" # type: str self.id = None @@ -990,19 +952,15 @@ class AzureResourceLink(_serialization.Model): """ _validation = { - 'id': {'readonly': True}, + "id": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.id = None @@ -1027,10 +985,10 @@ class CefExternalSecuritySolution(ExternalSecuritySolution): """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { @@ -1119,7 +1077,13 @@ def __init__( :keyword last_event_received: :paramtype last_event_received: str """ - super().__init__(additional_properties=additional_properties, device_vendor=device_vendor, device_type=device_type, workspace=workspace, **kwargs) + super().__init__( + additional_properties=additional_properties, + device_vendor=device_vendor, + device_type=device_type, + workspace=workspace, + **kwargs + ) self.hostname = hostname self.agent = agent self.last_event_received = last_event_received @@ -1143,11 +1107,11 @@ class CloudErrorBody(_serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { @@ -1158,12 +1122,8 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.code = None self.message = None @@ -1190,9 +1150,9 @@ class ConnectableResource(_serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'inbound_connected_resources': {'readonly': True}, - 'outbound_connected_resources': {'readonly': True}, + "id": {"readonly": True}, + "inbound_connected_resources": {"readonly": True}, + "outbound_connected_resources": {"readonly": True}, } _attribute_map = { @@ -1201,12 +1161,8 @@ class ConnectableResource(_serialization.Model): "outbound_connected_resources": {"key": "outboundConnectedResources", "type": "[ConnectedResource]"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.id = None self.inbound_connected_resources = None @@ -1227,9 +1183,9 @@ class ConnectedResource(_serialization.Model): """ _validation = { - 'connected_resource_id': {'readonly': True}, - 'tcp_ports': {'readonly': True}, - 'udp_ports': {'readonly': True}, + "connected_resource_id": {"readonly": True}, + "tcp_ports": {"readonly": True}, + "udp_ports": {"readonly": True}, } _attribute_map = { @@ -1238,12 +1194,8 @@ class ConnectedResource(_serialization.Model): "udp_ports": {"key": "udpPorts", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.connected_resource_id = None self.tcp_ports = None @@ -1261,12 +1213,7 @@ class ConnectedWorkspace(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs - ): + def __init__(self, *, id: Optional[str] = None, **kwargs): # pylint: disable=redefined-builtin """ :keyword id: Azure resource ID of the connected OMS workspace. :paramtype id: str @@ -1302,14 +1249,14 @@ class DiscoveredSecuritySolution(Resource, Location): """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'security_family': {'required': True}, - 'offer': {'required': True}, - 'publisher': {'required': True}, - 'sku': {'required': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "security_family": {"required": True}, + "offer": {"required": True}, + "publisher": {"required": True}, + "sku": {"required": True}, } _attribute_map = { @@ -1324,13 +1271,7 @@ class DiscoveredSecuritySolution(Resource, Location): } def __init__( - self, - *, - security_family: Union[str, "_models.SecurityFamily"], - offer: str, - publisher: str, - sku: str, - **kwargs + self, *, security_family: Union[str, "_models.SecurityFamily"], offer: str, publisher: str, sku: str, **kwargs ): """ :keyword security_family: The security family of the discovered solution. Required. Known @@ -1366,7 +1307,7 @@ class DiscoveredSecuritySolutionList(_serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -1374,12 +1315,7 @@ class DiscoveredSecuritySolutionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.DiscoveredSecuritySolution"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.DiscoveredSecuritySolution"]] = None, **kwargs): """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.DiscoveredSecuritySolution] @@ -1404,11 +1340,7 @@ class EffectiveNetworkSecurityGroups(_serialization.Model): } def __init__( - self, - *, - network_interface: Optional[str] = None, - network_security_groups: Optional[List[str]] = None, - **kwargs + self, *, network_interface: Optional[str] = None, network_security_groups: Optional[List[str]] = None, **kwargs ): """ :keyword network_interface: The Azure resource ID of the network interface. @@ -1434,8 +1366,8 @@ class ErrorAdditionalInfo(_serialization.Model): """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { @@ -1443,12 +1375,8 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.type = None self.info = None @@ -1466,7 +1394,7 @@ class ExternalSecuritySolutionList(_serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -1474,12 +1402,7 @@ class ExternalSecuritySolutionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ExternalSecuritySolution"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ExternalSecuritySolution"]] = None, **kwargs): """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.ExternalSecuritySolution] @@ -1501,7 +1424,7 @@ class JitNetworkAccessPoliciesList(_serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -1509,12 +1432,7 @@ class JitNetworkAccessPoliciesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.JitNetworkAccessPolicy"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.JitNetworkAccessPolicy"]] = None, **kwargs): """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.JitNetworkAccessPolicy] @@ -1535,12 +1453,7 @@ class Kind(_serialization.Model): "kind": {"key": "kind", "type": "str"}, } - def __init__( - self, - *, - kind: Optional[str] = None, - **kwargs - ): + def __init__(self, *, kind: Optional[str] = None, **kwargs): """ :keyword kind: Kind of the resource. :paramtype kind: str @@ -1577,12 +1490,12 @@ class JitNetworkAccessPolicy(Resource, Kind, Location): """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'virtual_machines': {'required': True}, - 'provisioning_state': {'readonly': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "virtual_machines": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -1640,8 +1553,8 @@ class JitNetworkAccessPolicyInitiatePort(_serialization.Model): """ _validation = { - 'number': {'required': True, 'maximum': 65535, 'minimum': 0}, - 'end_time_utc': {'required': True}, + "number": {"required": True, "maximum": 65535, "minimum": 0}, + "end_time_utc": {"required": True}, } _attribute_map = { @@ -1686,7 +1599,7 @@ class JitNetworkAccessPolicyInitiateRequest(_serialization.Model): """ _validation = { - 'virtual_machines': {'required': True}, + "virtual_machines": {"required": True}, } _attribute_map = { @@ -1726,8 +1639,8 @@ class JitNetworkAccessPolicyInitiateVirtualMachine(_serialization.Model): """ _validation = { - 'id': {'required': True}, - 'ports': {'required': True}, + "id": {"required": True}, + "ports": {"required": True}, } _attribute_map = { @@ -1769,8 +1682,8 @@ class JitNetworkAccessPolicyVirtualMachine(_serialization.Model): """ _validation = { - 'id': {'required': True}, - 'ports': {'required': True}, + "id": {"required": True}, + "ports": {"required": True}, } _attribute_map = { @@ -1823,9 +1736,9 @@ class JitNetworkAccessPortRule(_serialization.Model): """ _validation = { - 'number': {'required': True, 'maximum': 65535, 'minimum': 0}, - 'protocol': {'required': True}, - 'max_request_access_duration': {'required': True}, + "number": {"required": True, "maximum": 65535, "minimum": 0}, + "protocol": {"required": True}, + "max_request_access_duration": {"required": True}, } _attribute_map = { @@ -1887,9 +1800,9 @@ class JitNetworkAccessRequest(_serialization.Model): """ _validation = { - 'virtual_machines': {'required': True}, - 'start_time_utc': {'required': True}, - 'requestor': {'required': True}, + "virtual_machines": {"required": True}, + "start_time_utc": {"required": True}, + "requestor": {"required": True}, } _attribute_map = { @@ -1952,10 +1865,10 @@ class JitNetworkAccessRequestPort(_serialization.Model): """ _validation = { - 'number': {'required': True, 'maximum': 65535, 'minimum': 0}, - 'end_time_utc': {'required': True}, - 'status': {'required': True}, - 'status_reason': {'required': True}, + "number": {"required": True, "maximum": 65535, "minimum": 0}, + "end_time_utc": {"required": True}, + "status": {"required": True}, + "status_reason": {"required": True}, } _attribute_map = { @@ -2023,8 +1936,8 @@ class JitNetworkAccessRequestVirtualMachine(_serialization.Model): """ _validation = { - 'id': {'required': True}, - 'ports': {'required': True}, + "id": {"required": True}, + "ports": {"required": True}, } _attribute_map = { @@ -2072,11 +1985,11 @@ class OnPremiseResourceDetails(ResourceDetails): """ _validation = { - 'source': {'required': True}, - 'workspace_id': {'required': True}, - 'vmuuid': {'required': True}, - 'source_computer_id': {'required': True}, - 'machine_name': {'required': True}, + "source": {"required": True}, + "workspace_id": {"required": True}, + "vmuuid": {"required": True}, + "source_computer_id": {"required": True}, + "machine_name": {"required": True}, } _attribute_map = { @@ -2087,19 +2000,9 @@ class OnPremiseResourceDetails(ResourceDetails): "machine_name": {"key": "machineName", "type": "str"}, } - _subtype_map = { - 'source': {'OnPremiseSql': 'OnPremiseSqlResourceDetails'} - } + _subtype_map = {"source": {"OnPremiseSql": "OnPremiseSqlResourceDetails"}} - def __init__( - self, - *, - workspace_id: str, - vmuuid: str, - source_computer_id: str, - machine_name: str, - **kwargs - ): + def __init__(self, *, workspace_id: str, vmuuid: str, source_computer_id: str, machine_name: str, **kwargs): """ :keyword workspace_id: Azure resource Id of the workspace the machine is attached to. Required. :paramtype workspace_id: str @@ -2111,7 +2014,7 @@ def __init__( :paramtype machine_name: str """ super().__init__(**kwargs) - self.source = 'OnPremise' # type: str + self.source = "OnPremise" # type: str self.workspace_id = workspace_id self.vmuuid = vmuuid self.source_computer_id = source_computer_id @@ -2141,13 +2044,13 @@ class OnPremiseSqlResourceDetails(OnPremiseResourceDetails): """ _validation = { - 'source': {'required': True}, - 'workspace_id': {'required': True}, - 'vmuuid': {'required': True}, - 'source_computer_id': {'required': True}, - 'machine_name': {'required': True}, - 'server_name': {'required': True}, - 'database_name': {'required': True}, + "source": {"required": True}, + "workspace_id": {"required": True}, + "vmuuid": {"required": True}, + "source_computer_id": {"required": True}, + "machine_name": {"required": True}, + "server_name": {"required": True}, + "database_name": {"required": True}, } _attribute_map = { @@ -2185,8 +2088,14 @@ def __init__( :keyword database_name: The Sql database name installed on the machine. Required. :paramtype database_name: str """ - super().__init__(workspace_id=workspace_id, vmuuid=vmuuid, source_computer_id=source_computer_id, machine_name=machine_name, **kwargs) - self.source = 'OnPremiseSql' # type: str + super().__init__( + workspace_id=workspace_id, + vmuuid=vmuuid, + source_computer_id=source_computer_id, + machine_name=machine_name, + **kwargs + ) + self.source = "OnPremiseSql" # type: str self.server_name = server_name self.database_name = database_name @@ -2402,7 +2311,7 @@ class Rule(_serialization.Model): """ _validation = { - 'destination_port': {'maximum': 65535, 'minimum': 0}, + "destination_port": {"maximum": 65535, "minimum": 0}, } _attribute_map = { @@ -2470,14 +2379,14 @@ class SecureScoreControlDefinitionItem(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'display_name': {'readonly': True}, - 'description': {'readonly': True, 'max_length': 256}, - 'max_score': {'readonly': True, 'maximum': 10, 'minimum': 0}, - 'source': {'readonly': True}, - 'assessment_definitions': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "display_name": {"readonly": True}, + "description": {"readonly": True, "max_length": 256}, + "max_score": {"readonly": True, "maximum": 10, "minimum": 0}, + "source": {"readonly": True}, + "assessment_definitions": {"readonly": True}, } _attribute_map = { @@ -2491,12 +2400,8 @@ class SecureScoreControlDefinitionItem(Resource): "assessment_definitions": {"key": "properties.assessmentDefinitions", "type": "[AzureResourceLink]"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.display_name = None self.description = None @@ -2517,8 +2422,8 @@ class SecureScoreControlDefinitionList(_serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -2526,12 +2431,8 @@ class SecureScoreControlDefinitionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.value = None self.next_link = None @@ -2549,12 +2450,7 @@ class SecureScoreControlDefinitionSource(_serialization.Model): "source_type": {"key": "sourceType", "type": "str"}, } - def __init__( - self, - *, - source_type: Optional[Union[str, "_models.ControlType"]] = None, - **kwargs - ): + def __init__(self, *, source_type: Optional[Union[str, "_models.ControlType"]] = None, **kwargs): """ :keyword source_type: The type of security control (for example, BuiltIn). Known values are: "BuiltIn" and "Custom". @@ -2598,17 +2494,17 @@ class SecureScoreControlDetails(Resource): # pylint: disable=too-many-instance- """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'display_name': {'readonly': True}, - 'healthy_resource_count': {'readonly': True}, - 'unhealthy_resource_count': {'readonly': True}, - 'not_applicable_resource_count': {'readonly': True}, - 'weight': {'readonly': True, 'minimum': 0}, - 'max': {'readonly': True, 'minimum': 0}, - 'current': {'readonly': True, 'minimum': 0}, - 'percentage': {'readonly': True, 'maximum': 1, 'minimum': 0}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "display_name": {"readonly": True}, + "healthy_resource_count": {"readonly": True}, + "unhealthy_resource_count": {"readonly": True}, + "not_applicable_resource_count": {"readonly": True}, + "weight": {"readonly": True, "minimum": 0}, + "max": {"readonly": True, "minimum": 0}, + "current": {"readonly": True, "minimum": 0}, + "percentage": {"readonly": True, "maximum": 1, "minimum": 0}, } _attribute_map = { @@ -2626,12 +2522,7 @@ class SecureScoreControlDetails(Resource): # pylint: disable=too-many-instance- "percentage": {"key": "properties.score.percentage", "type": "float"}, } - def __init__( - self, - *, - definition: Optional["_models.SecureScoreControlDefinitionItem"] = None, - **kwargs - ): + def __init__(self, *, definition: Optional["_models.SecureScoreControlDefinitionItem"] = None, **kwargs): """ :keyword definition: Information about the security control. :paramtype definition: ~azure.mgmt.security.v2020_01_01.models.SecureScoreControlDefinitionItem @@ -2660,8 +2551,8 @@ class SecureScoreControlList(_serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -2669,12 +2560,8 @@ class SecureScoreControlList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.value = None self.next_link = None @@ -2696,9 +2583,9 @@ class SecureScoreControlScore(_serialization.Model): """ _validation = { - 'max': {'readonly': True, 'maximum': 10, 'minimum': 0}, - 'current': {'readonly': True, 'maximum': 10, 'minimum': 0}, - 'percentage': {'readonly': True, 'maximum': 1, 'minimum': 0}, + "max": {"readonly": True, "maximum": 10, "minimum": 0}, + "current": {"readonly": True, "maximum": 10, "minimum": 0}, + "percentage": {"readonly": True, "maximum": 1, "minimum": 0}, } _attribute_map = { @@ -2707,12 +2594,8 @@ class SecureScoreControlScore(_serialization.Model): "percentage": {"key": "percentage", "type": "float"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.max = None self.current = None @@ -2745,14 +2628,14 @@ class SecureScoreItem(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'display_name': {'readonly': True}, - 'weight': {'readonly': True, 'minimum': 0}, - 'max': {'readonly': True, 'minimum': 0}, - 'current': {'readonly': True, 'minimum': 0}, - 'percentage': {'readonly': True, 'maximum': 1, 'minimum': 0}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "display_name": {"readonly": True}, + "weight": {"readonly": True, "minimum": 0}, + "max": {"readonly": True, "minimum": 0}, + "current": {"readonly": True, "minimum": 0}, + "percentage": {"readonly": True, "maximum": 1, "minimum": 0}, } _attribute_map = { @@ -2766,12 +2649,8 @@ class SecureScoreItem(Resource): "percentage": {"key": "properties.score.percentage", "type": "float"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.display_name = None self.weight = None @@ -2792,8 +2671,8 @@ class SecureScoresList(_serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -2801,12 +2680,8 @@ class SecureScoresList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.value = None self.next_link = None @@ -2840,11 +2715,11 @@ class SecurityAssessment(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'display_name': {'readonly': True}, - 'links': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "display_name": {"readonly": True}, + "links": {"readonly": True}, } _attribute_map = { @@ -2905,8 +2780,8 @@ class SecurityAssessmentList(_serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -2914,12 +2789,8 @@ class SecurityAssessmentList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.value = None self.next_link = None @@ -2972,10 +2843,10 @@ class SecurityAssessmentMetadata(Resource): # pylint: disable=too-many-instance """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'policy_definition_id': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "policy_definition_id": {"readonly": True}, } _attribute_map = { @@ -3071,8 +2942,8 @@ class SecurityAssessmentMetadataList(_serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -3080,12 +2951,8 @@ class SecurityAssessmentMetadataList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.value = None self.next_link = None @@ -3106,8 +2973,8 @@ class SecurityAssessmentMetadataPartnerData(_serialization.Model): """ _validation = { - 'partner_name': {'required': True}, - 'secret': {'required': True}, + "partner_name": {"required": True}, + "secret": {"required": True}, } _attribute_map = { @@ -3116,14 +2983,7 @@ class SecurityAssessmentMetadataPartnerData(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - partner_name: str, - secret: str, - product_name: Optional[str] = None, - **kwargs - ): + def __init__(self, *, partner_name: str, secret: str, product_name: Optional[str] = None, **kwargs): """ :keyword partner_name: Name of the company of the partner. Required. :paramtype partner_name: str @@ -3182,10 +3042,10 @@ class SecurityAssessmentMetadataProperties(_serialization.Model): # pylint: dis """ _validation = { - 'display_name': {'required': True}, - 'policy_definition_id': {'readonly': True}, - 'severity': {'required': True}, - 'assessment_type': {'required': True}, + "display_name": {"required": True}, + "policy_definition_id": {"readonly": True}, + "severity": {"required": True}, + "assessment_type": {"required": True}, } _attribute_map = { @@ -3278,8 +3138,8 @@ class SecurityAssessmentPartnerData(_serialization.Model): """ _validation = { - 'partner_name': {'required': True}, - 'secret': {'required': True}, + "partner_name": {"required": True}, + "secret": {"required": True}, } _attribute_map = { @@ -3287,13 +3147,7 @@ class SecurityAssessmentPartnerData(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - partner_name: str, - secret: str, - **kwargs - ): + def __init__(self, *, partner_name: str, secret: str, **kwargs): """ :keyword partner_name: Name of the company of the partner. Required. :paramtype partner_name: str @@ -3331,10 +3185,10 @@ class SecuritySolution(Resource, Location): """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { @@ -3392,7 +3246,7 @@ class SecuritySolutionList(_serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -3400,12 +3254,7 @@ class SecuritySolutionList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.SecuritySolution"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.SecuritySolution"]] = None, **kwargs): """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.SecuritySolution] @@ -3448,17 +3297,17 @@ class SecuritySolutionsReferenceData(Resource, Location): # pylint: disable=too """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'security_family': {'required': True}, - 'alert_vendor_name': {'required': True}, - 'package_info_url': {'required': True}, - 'product_name': {'required': True}, - 'publisher': {'required': True}, - 'publisher_display_name': {'required': True}, - 'template': {'required': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "security_family": {"required": True}, + "alert_vendor_name": {"required": True}, + "package_info_url": {"required": True}, + "product_name": {"required": True}, + "publisher": {"required": True}, + "publisher_display_name": {"required": True}, + "template": {"required": True}, } _attribute_map = { @@ -3529,12 +3378,7 @@ class SecuritySolutionsReferenceDataList(_serialization.Model): "value": {"key": "value", "type": "[SecuritySolutionsReferenceData]"}, } - def __init__( - self, - *, - value: Optional[List["_models.SecuritySolutionsReferenceData"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.SecuritySolutionsReferenceData"]] = None, **kwargs): """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.SecuritySolutionsReferenceData] @@ -3562,10 +3406,10 @@ class ServerVulnerabilityAssessment(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -3575,12 +3419,8 @@ class ServerVulnerabilityAssessment(Resource): "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.provisioning_state = None @@ -3596,12 +3436,7 @@ class ServerVulnerabilityAssessmentsList(_serialization.Model): "value": {"key": "value", "type": "[ServerVulnerabilityAssessment]"}, } - def __init__( - self, - *, - value: Optional[List["_models.ServerVulnerabilityAssessment"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ServerVulnerabilityAssessment"]] = None, **kwargs): """ :keyword value: :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.ServerVulnerabilityAssessment] @@ -3622,8 +3457,8 @@ class TopologyList(_serialization.Model): """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -3631,12 +3466,8 @@ class TopologyList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.value = None self.next_link = None @@ -3663,12 +3494,12 @@ class TopologyResource(Resource, Location): """ _validation = { - 'location': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'calculated_date_time': {'readonly': True}, - 'topology_resources': {'readonly': True}, + "location": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "calculated_date_time": {"readonly": True}, + "topology_resources": {"readonly": True}, } _attribute_map = { @@ -3680,12 +3511,8 @@ class TopologyResource(Resource, Location): "topology_resources": {"key": "properties.topologyResources", "type": "[TopologySingleResource]"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.location = None self.calculated_date_time = None @@ -3722,14 +3549,14 @@ class TopologySingleResource(_serialization.Model): """ _validation = { - 'resource_id': {'readonly': True}, - 'severity': {'readonly': True}, - 'recommendations_exist': {'readonly': True}, - 'network_zones': {'readonly': True}, - 'topology_score': {'readonly': True}, - 'location': {'readonly': True}, - 'parents': {'readonly': True}, - 'children': {'readonly': True}, + "resource_id": {"readonly": True}, + "severity": {"readonly": True}, + "recommendations_exist": {"readonly": True}, + "network_zones": {"readonly": True}, + "topology_score": {"readonly": True}, + "location": {"readonly": True}, + "parents": {"readonly": True}, + "children": {"readonly": True}, } _attribute_map = { @@ -3743,12 +3570,8 @@ class TopologySingleResource(_serialization.Model): "children": {"key": "children", "type": "[TopologySingleResourceChild]"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.resource_id = None self.severity = None @@ -3770,19 +3593,15 @@ class TopologySingleResourceChild(_serialization.Model): """ _validation = { - 'resource_id': {'readonly': True}, + "resource_id": {"readonly": True}, } _attribute_map = { "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.resource_id = None @@ -3797,19 +3616,15 @@ class TopologySingleResourceParent(_serialization.Model): """ _validation = { - 'resource_id': {'readonly': True}, + "resource_id": {"readonly": True}, } _attribute_map = { "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.resource_id = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py index c66b5e0d8b5e..3521c0d26140 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py @@ -11,16 +11,15 @@ class AadConnectivityStateEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The connectivity state of the external AAD solution. - """ + """The connectivity state of the external AAD solution.""" DISCOVERED = "Discovered" NOT_LICENSED = "NotLicensed" CONNECTED = "Connected" + class AdaptiveApplicationControlIssue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """An alert that machines within a group can have. - """ + """An alert that machines within a group can have.""" VIOLATIONS_AUDITED = "ViolationsAudited" VIOLATIONS_BLOCKED = "ViolationsBlocked" @@ -29,9 +28,9 @@ class AdaptiveApplicationControlIssue(str, Enum, metaclass=CaseInsensitiveEnumMe EXECUTABLE_VIOLATIONS_AUDITED = "ExecutableViolationsAudited" RULES_VIOLATED_MANUALLY = "RulesViolatedManually" + class AssessmentStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Programmatic code for the status of the assessment. - """ + """Programmatic code for the status of the assessment.""" #: The resource is healthy HEALTHY = "Healthy" @@ -40,6 +39,7 @@ class AssessmentStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: Assessment for this resource did not happen NOT_APPLICABLE = "NotApplicable" + class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """BuiltIn if the assessment based on built-in Azure Policy definition, Custom if the assessment based on custom Azure Policy definition. @@ -56,9 +56,9 @@ class AssessmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: An assessment that was created by a verified 3rd party if the user connected it to ASC VERIFIED_PARTNER = "VerifiedPartner" + class Categories(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The categories of resource that is at risk when the assessment is unhealthy. - """ + """The categories of resource that is at risk when the assessment is unhealthy.""" COMPUTE = "Compute" NETWORKING = "Networking" @@ -66,9 +66,9 @@ class Categories(str, Enum, metaclass=CaseInsensitiveEnumMeta): IDENTITY_AND_ACCESS = "IdentityAndAccess" IO_T = "IoT" + class ConfigurationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The configuration status of the machines group or machine or rule. - """ + """The configuration status of the machines group or machine or rule.""" CONFIGURED = "Configured" NOT_CONFIGURED = "NotConfigured" @@ -76,72 +76,72 @@ class ConfigurationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" NO_STATUS = "NoStatus" + class ConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ConnectionType. - """ + """ConnectionType.""" INTERNAL = "Internal" EXTERNAL = "External" + class ControlType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of security control (for example, BuiltIn). - """ + """The type of security control (for example, BuiltIn).""" #: Microsoft Defender for Cloud managed assessments BUILT_IN = "BuiltIn" #: Non Microsoft Defender for Cloud managed assessments CUSTOM = "Custom" + class Direction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The rule's direction. - """ + """The rule's direction.""" INBOUND = "Inbound" OUTBOUND = "Outbound" + class EnforcementMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The application control policy enforcement/protection mode of the machine group. - """ + """The application control policy enforcement/protection mode of the machine group.""" AUDIT = "Audit" ENFORCE = "Enforce" NONE = "None" + class EnforcementSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The machine supportability of Enforce feature. - """ + """The machine supportability of Enforce feature.""" SUPPORTED = "Supported" NOT_SUPPORTED = "NotSupported" UNKNOWN = "Unknown" + class ExpandControlsEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ExpandControlsEnum. - """ + """ExpandControlsEnum.""" #: Add definition object for each control DEFINITION = "definition" + class ExpandEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ExpandEnum. - """ + """ExpandEnum.""" #: All links associated with an assessment LINKS = "links" #: Assessment metadata METADATA = "metadata" + class ExternalSecuritySolutionKindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of the external solution. - """ + """The kind of the external solution.""" CEF = "CEF" ATA = "ATA" AAD = "AAD" + class FileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the file (for Linux files - Executable is used). - """ + """The type of the file (for Linux files - Executable is used).""" EXE = "Exe" DLL = "Dll" @@ -150,50 +150,50 @@ class FileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): EXECUTABLE = "Executable" UNKNOWN = "Unknown" + class ImplementationEffort(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The implementation effort required to remediate this assessment. - """ + """The implementation effort required to remediate this assessment.""" LOW = "Low" MODERATE = "Moderate" HIGH = "High" + class ProtocolEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ProtocolEnum. - """ + """ProtocolEnum.""" TCP = "TCP" UDP = "UDP" ALL = "*" + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The security family provisioning State. - """ + """The security family provisioning State.""" SUCCEEDED = "Succeeded" FAILED = "Failed" UPDATING = "Updating" + class RecommendationAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The recommendation action of the machine or rule. - """ + """The recommendation action of the machine or rule.""" RECOMMENDED = "Recommended" ADD = "Add" REMOVE = "Remove" + class RecommendationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The initial recommendation status of the machine group or machine. - """ + """The initial recommendation status of the machine group or machine.""" RECOMMENDED = "Recommended" NOT_RECOMMENDED = "NotRecommended" NOT_AVAILABLE = "NotAvailable" NO_STATUS = "NoStatus" + class RecommendationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the rule to be allowed. - """ + """The type of the rule to be allowed.""" FILE = "File" FILE_HASH = "FileHash" @@ -202,18 +202,18 @@ class RecommendationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): BINARY_SIGNATURE = "BinarySignature" VERSION_AND_ABOVE_SIGNATURE = "VersionAndAboveSignature" + class SecurityFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The security family of the discovered solution. - """ + """The security family of the discovered solution.""" WAF = "Waf" NGFW = "Ngfw" SAAS_WAF = "SaasWaf" VA = "Va" + class ServerVulnerabilityAssessmentPropertiesProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioningState of the vulnerability assessment capability on the VM. - """ + """The provisioningState of the vulnerability assessment capability on the VM.""" SUCCEEDED = "Succeeded" FAILED = "Failed" @@ -221,17 +221,17 @@ class ServerVulnerabilityAssessmentPropertiesProvisioningState(str, Enum, metacl PROVISIONING = "Provisioning" DEPROVISIONING = "Deprovisioning" + class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The severity level of the assessment. - """ + """The severity level of the assessment.""" LOW = "Low" MEDIUM = "Medium" HIGH = "High" + class Source(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The platform where the assessed resource resides. - """ + """The platform where the assessed resource resides.""" #: Resource is in Azure AZURE = "Azure" @@ -240,9 +240,9 @@ class Source(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: SQL Resource in an on premise machine connected to Azure cloud ON_PREMISE_SQL = "OnPremiseSql" + class SourceSystem(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The source type of the machine group. - """ + """The source type of the machine group.""" AZURE_APP_LOCKER = "Azure_AppLocker" AZURE_AUDIT_D = "Azure_AuditD" @@ -250,24 +250,24 @@ class SourceSystem(str, Enum, metaclass=CaseInsensitiveEnumMeta): NON_AZURE_AUDIT_D = "NonAzure_AuditD" NONE = "None" + class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of the port. - """ + """The status of the port.""" REVOKED = "Revoked" INITIATED = "Initiated" + class StatusReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A description of why the ``status`` has its value. - """ + """A description of why the ``status`` has its value.""" EXPIRED = "Expired" USER_REQUESTED = "UserRequested" NEWER_REQUEST_INITIATED = "NewerRequestInitiated" + class Threats(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Threats impact of the assessment. - """ + """Threats impact of the assessment.""" ACCOUNT_BREACH = "accountBreach" DATA_EXFILTRATION = "dataExfiltration" @@ -278,16 +278,16 @@ class Threats(str, Enum, metaclass=CaseInsensitiveEnumMeta): MISSING_COVERAGE = "missingCoverage" DENIAL_OF_SERVICE = "denialOfService" + class TransportProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """TransportProtocol. - """ + """TransportProtocol.""" TCP = "TCP" UDP = "UDP" + class UserImpact(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The user impact of the assessment. - """ + """The user impact of the assessment.""" LOW = "Low" MODERATE = "Moderate" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py index 576ef208ecc5..fff0749da585 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +49,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +83,7 @@ def build_get_request(asc_location: str, group_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +114,7 @@ def build_put_request(asc_location: str, group_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -143,7 +148,7 @@ def build_delete_request(asc_location: str, group_name: str, subscription_id: st _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -215,7 +220,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroups] request = build_list_request( @@ -274,7 +279,7 @@ def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.Adap _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] request = build_get_request( @@ -394,7 +399,7 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveApplicationControlGroup] @@ -467,7 +472,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py index 8865ab45899f..306da09fb4c1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +54,7 @@ def build_list_by_extended_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +97,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,8 +145,8 @@ def build_enforce_request( adaptive_network_hardening_enforce_action = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + ) # type: Literal["enforce"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -225,7 +230,7 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardeningsList] error_map = { @@ -255,10 +260,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -329,7 +341,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AdaptiveNetworkHardening] request = build_get_request( @@ -389,8 +401,8 @@ def _enforce_initial( # pylint: disable=inconsistent-return-statements adaptive_network_hardening_enforce_action = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + ) # type: Literal["enforce"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -586,8 +598,8 @@ def begin_enforce( adaptive_network_hardening_enforce_action = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" - ) # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + ) # type: Literal["enforce"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py index 5f4d6def55bf..6929ecb0f58a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +71,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,14 +100,14 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * def build_get_request( resource_group_name: str, asc_location: str, - connection_type: Union[str, "_models.ConnectionType"], + connection_type: Union[str, _models.ConnectionType], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +170,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.AllowedConnectionsResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] error_map = { @@ -191,10 +196,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -242,7 +254,7 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsList] error_map = { @@ -269,10 +281,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -308,7 +327,7 @@ def get( self, resource_group_name: str, asc_location: str, - connection_type: Union[str, "_models.ConnectionType"], + connection_type: Union[str, _models.ConnectionType], **kwargs: Any ) -> _models.AllowedConnectionsResource: """Gets the list of all possible traffic between resources for the subscription and location, @@ -339,7 +358,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AllowedConnectionsResource] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py index 82b2105674c2..437167903c12 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +64,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +88,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +116,7 @@ def build_get_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +148,7 @@ def build_create_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -178,7 +183,7 @@ def build_delete_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +242,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadata"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] error_map = { @@ -262,10 +267,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -319,7 +331,7 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] request = build_get_request( @@ -365,7 +377,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecurityAsses _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataList] error_map = { @@ -391,10 +403,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -448,7 +467,7 @@ def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] request = build_get_in_subscription_request( @@ -566,7 +585,7 @@ def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadata] @@ -637,7 +656,7 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_in_subscription_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py index 23da392cf2b1..6ed562817062 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,12 +66,12 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: def build_get_request( - resource_id: str, assessment_name: str, *, expand: Optional[Union[str, "_models.ExpandEnum"]] = None, **kwargs: Any + resource_id: str, assessment_name: str, *, expand: Optional[Union[str, _models.ExpandEnum]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +98,7 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -121,7 +126,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +183,7 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.SecurityAssessmen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] error_map = { @@ -204,10 +209,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -243,7 +255,7 @@ def get( self, resource_id: str, assessment_name: str, - expand: Optional[Union[str, "_models.ExpandEnum"]] = None, + expand: Optional[Union[str, _models.ExpandEnum]] = None, **kwargs: Any ) -> _models.SecurityAssessment: """Get a security assessment on your scanned resource. @@ -271,7 +283,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] request = build_get_request( @@ -394,7 +406,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessment] @@ -470,7 +482,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py index d223fdf7340c..e5fc10eda33b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +73,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +109,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +174,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DiscoveredSecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] error_map = { @@ -195,10 +200,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -246,7 +258,7 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolutionList] error_map = { @@ -273,10 +285,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -337,7 +356,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.DiscoveredSecuritySolution] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py index af77fba3ea31..00a0e84c865b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +73,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +109,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +174,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ExternalSecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] error_map = { @@ -195,10 +200,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -246,7 +258,7 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolutionList] error_map = { @@ -273,10 +285,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -337,7 +356,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ExternalSecuritySolution] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py index 766cfc7c97be..6f6bd6431853 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +73,7 @@ def build_list_by_region_request(asc_location: str, subscription_id: str, **kwar _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +103,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +137,7 @@ def build_list_by_resource_group_and_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +176,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +218,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -258,7 +263,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -302,8 +307,8 @@ def build_initiate_request( jit_network_access_policy_initiate_type = kwargs.pop( "jit_network_access_policy_initiate_type", "initiate" - ) # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + ) # type: Literal["initiate"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -374,7 +379,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.JitNetworkAccessPolicy"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] error_map = { @@ -400,10 +405,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -452,7 +464,7 @@ def list_by_region(self, asc_location: str, **kwargs: Any) -> Iterable["_models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] error_map = { @@ -479,10 +491,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -533,7 +552,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] error_map = { @@ -560,10 +579,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -617,7 +643,7 @@ def list_by_resource_group_and_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPoliciesList] error_map = { @@ -645,10 +671,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -711,7 +744,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] request = build_get_request( @@ -853,7 +886,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessPolicy] @@ -931,7 +964,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -1083,8 +1116,8 @@ def initiate( jit_network_access_policy_initiate_type = kwargs.pop( "jit_network_access_policy_initiate_type", "initiate" - ) # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + ) # type: Literal["initiate"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.JitNetworkAccessRequest] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py index e2aeb24faf82..3bb1cbd8d86d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +64,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +121,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecureScoreControlDefinitionI _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] error_map = { @@ -141,10 +146,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -190,7 +202,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecureScoreCo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlDefinitionList] error_map = { @@ -216,10 +228,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py index bb5e8a114e42..e5720ed24935 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,13 +45,13 @@ def build_list_by_secure_score_request( secure_score_name: str, subscription_id: str, *, - expand: Optional[Union[str, "_models.ExpandControlsEnum"]] = None, + expand: Optional[Union[str, _models.ExpandControlsEnum]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,12 +80,12 @@ def build_list_by_secure_score_request( def build_list_request( - subscription_id: str, *, expand: Optional[Union[str, "_models.ExpandControlsEnum"]] = None, **kwargs: Any + subscription_id: str, *, expand: Optional[Union[str, _models.ExpandControlsEnum]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +132,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def list_by_secure_score( - self, secure_score_name: str, expand: Optional[Union[str, "_models.ExpandControlsEnum"]] = None, **kwargs: Any + self, secure_score_name: str, expand: Optional[Union[str, _models.ExpandControlsEnum]] = None, **kwargs: Any ) -> Iterable["_models.SecureScoreControlDetails"]: """Get all security controls for a specific initiative within a scope. @@ -146,7 +151,7 @@ def list_by_secure_score( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] error_map = { @@ -174,10 +179,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -210,7 +222,7 @@ def get_next(next_link=None): @distributed_trace def list( - self, expand: Optional[Union[str, "_models.ExpandControlsEnum"]] = None, **kwargs: Any + self, expand: Optional[Union[str, _models.ExpandControlsEnum]] = None, **kwargs: Any ) -> Iterable["_models.SecureScoreControlDetails"]: """Get all security controls within a scope. @@ -226,7 +238,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreControlList] error_map = { @@ -253,10 +265,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py index 7afefc7523a3..42a221dadd27 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +71,7 @@ def build_get_request(secure_score_name: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +128,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecureScoreItem"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoresList] error_map = { @@ -149,10 +154,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -207,7 +219,7 @@ def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecureScoreItem] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py index fbf12bc96fa9..d32ce7c086dd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +73,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +134,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionList] error_map = { @@ -155,10 +160,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -219,7 +231,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolution] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py index 753e4b7ea0ea..44d4baec6c5a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +71,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +136,7 @@ def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] request = build_list_request( @@ -186,7 +191,7 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.Secur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecuritySolutionsReferenceDataList] request = build_list_by_home_region_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py index a9f17636c842..f49d3fd4d88f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,7 @@ def build_list_by_extended_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,8 +94,10 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop("server_vulnerability_assessment", "default") # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,8 +142,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop("server_vulnerability_assessment", "default") # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,8 +190,10 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop("server_vulnerability_assessment", "default") # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -266,7 +277,7 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessmentsList] request = build_list_by_extended_resource_request( @@ -337,8 +348,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop("server_vulnerability_assessment", "default") # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] request = build_get_request( @@ -411,8 +424,10 @@ def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop("server_vulnerability_assessment", "default") # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ServerVulnerabilityAssessment] request = build_create_or_update_request( @@ -463,8 +478,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop("server_vulnerability_assessment", "default") # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -531,8 +548,10 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - server_vulnerability_assessment = kwargs.pop("server_vulnerability_assessment", "default") # type: str - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + server_vulnerability_assessment = kwargs.pop( + "server_vulnerability_assessment", "default" + ) # type: Literal["default"] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py index 1cca6ef8ceba..c0e23166eb5f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +71,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +103,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +164,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.TopologyResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] error_map = { @@ -185,10 +190,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -234,7 +246,7 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyList] error_map = { @@ -261,10 +273,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -325,7 +344,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) # type: Literal["2020-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.TopologyResource] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py index ae35f0fad6a3..16b000307558 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-01-01-preview") # type: str + api_version = kwargs.pop("api_version", "2020-01-01-preview") # type: Literal["2020-01-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json index 047d717b391b..3e2097810054 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "connectors": "ConnectorsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py index 23906b4c7b04..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/__init__.py @@ -14,7 +14,10 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['SecurityCenter'] + +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py index 954856784769..4c63533d8d8d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -34,14 +40,9 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in :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: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-01-01-preview") # type: str + api_version = kwargs.pop("api_version", "2020-01-01-preview") # type: Literal["2020-01-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +52,21 @@ def __init__( 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-security/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py index fa0a5e2b3f88..2c1984123c43 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py @@ -21,6 +21,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential + class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword """API spec for Microsoft.Security (Azure Security Center) resource provider. @@ -52,16 +53,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.connectors = ConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.connectors = ConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py index 1d6239b35b09..36717e9887ca 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ConnectorsOperations', + "ConnectorsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py index faeb687dcc68..e71f9e9c6b8e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -21,10 +29,21 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._connectors_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request -T = TypeVar('T') +from ...operations._connectors_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class ConnectorsOperations: """ .. warning:: @@ -44,12 +63,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ConnectorSetting"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.ConnectorSetting"]: """Cloud accounts connectors of a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,20 +76,26 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectorSettingList] + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSettingList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,10 +104,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,9 +131,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,18 +141,12 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} # type: ignore @distributed_trace_async - async def get( - self, - connector_name: str, - **kwargs: Any - ) -> _models.ConnectorSetting: + async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: """Details of a specific cloud account connector. :param connector_name: Name of the cloud account connector. Required. @@ -137,22 +157,26 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectorSetting] + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] - request = build_get_request( connector_name=connector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -160,9 +184,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -171,15 +193,14 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ConnectorSetting', pipeline_response) + deserialized = self._deserialize("ConnectorSetting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore @overload async def create_or_update( @@ -209,12 +230,7 @@ async def create_or_update( @overload async def create_or_update( - self, - connector_name: str, - connector_setting: IO, - *, - content_type: str = "application/json", - **kwargs: Any + self, connector_name: str, connector_setting: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.ConnectorSetting: """Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either account credentials or role-based authentication. For GCP, use account @@ -233,13 +249,9 @@ async def create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async async def create_or_update( - self, - connector_name: str, - connector_setting: Union[_models.ConnectorSetting, IO], - **kwargs: Any + self, connector_name: str, connector_setting: Union[_models.ConnectorSetting, IO], **kwargs: Any ) -> _models.ConnectorSetting: """Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either account credentials or role-based authentication. For GCP, use account @@ -259,16 +271,21 @@ async def create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectorSetting] + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] content_type = content_type or "application/json" _json = None @@ -276,7 +293,7 @@ async def create_or_update( if isinstance(connector_setting, (IO, bytes)): _content = connector_setting else: - _json = self._serialize.body(connector_setting, 'ConnectorSetting') + _json = self._serialize.body(connector_setting, "ConnectorSetting") request = build_create_or_update_request( connector_name=connector_name, @@ -285,7 +302,7 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata['url'], + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -293,9 +310,7 @@ async def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -304,21 +319,18 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ConnectorSetting', pipeline_response) + deserialized = self._deserialize("ConnectorSetting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, - connector_name: str, - **kwargs: Any + self, connector_name: str, **kwargs: Any ) -> None: """Delete a cloud account connector from a subscription. @@ -330,22 +342,26 @@ async def delete( # pylint: disable=inconsistent-return-statements :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( connector_name=connector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -353,9 +369,7 @@ async def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -367,5 +381,4 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_patch.py @@ -10,6 +10,7 @@ __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. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py index 0fb2cfc7e30d..4d965dbf3b31 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/__init__.py @@ -27,24 +27,25 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AuthenticationDetailsProperties', - 'AwAssumeRoleAuthenticationDetailsProperties', - 'AwsCredsAuthenticationDetailsProperties', - 'CloudErrorBody', - 'ConnectorSetting', - 'ConnectorSettingList', - 'ErrorAdditionalInfo', - 'GcpCredentialsDetailsProperties', - 'HybridComputeSettingsProperties', - 'ProxyServerProperties', - 'Resource', - 'ServicePrincipalProperties', - 'AuthenticationProvisioningState', - 'AuthenticationType', - 'AutoProvision', - 'HybridComputeProvisioningState', - 'PermissionProperty', + "AuthenticationDetailsProperties", + "AwAssumeRoleAuthenticationDetailsProperties", + "AwsCredsAuthenticationDetailsProperties", + "CloudErrorBody", + "ConnectorSetting", + "ConnectorSettingList", + "ErrorAdditionalInfo", + "GcpCredentialsDetailsProperties", + "HybridComputeSettingsProperties", + "ProxyServerProperties", + "Resource", + "ServicePrincipalProperties", + "AuthenticationProvisioningState", + "AuthenticationType", + "AutoProvision", + "HybridComputeProvisioningState", + "PermissionProperty", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py index f9aa761a4a4c..7b508a23d1f2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_models_py3.py @@ -42,9 +42,9 @@ class AuthenticationDetailsProperties(_serialization.Model): """ _validation = { - 'authentication_provisioning_state': {'readonly': True}, - 'granted_permissions': {'readonly': True}, - 'authentication_type': {'required': True}, + "authentication_provisioning_state": {"readonly": True}, + "granted_permissions": {"readonly": True}, + "authentication_type": {"required": True}, } _attribute_map = { @@ -54,15 +54,15 @@ class AuthenticationDetailsProperties(_serialization.Model): } _subtype_map = { - 'authentication_type': {'awsAssumeRole': 'AwAssumeRoleAuthenticationDetailsProperties', 'awsCreds': 'AwsCredsAuthenticationDetailsProperties', 'gcpCredentials': 'GcpCredentialsDetailsProperties'} + "authentication_type": { + "awsAssumeRole": "AwAssumeRoleAuthenticationDetailsProperties", + "awsCreds": "AwsCredsAuthenticationDetailsProperties", + "gcpCredentials": "GcpCredentialsDetailsProperties", + } } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.authentication_provisioning_state = None self.granted_permissions = None @@ -99,12 +99,12 @@ class AwAssumeRoleAuthenticationDetailsProperties(AuthenticationDetailsPropertie """ _validation = { - 'authentication_provisioning_state': {'readonly': True}, - 'granted_permissions': {'readonly': True}, - 'authentication_type': {'required': True}, - 'account_id': {'readonly': True}, - 'aws_assume_role_arn': {'required': True}, - 'aws_external_id': {'required': True}, + "authentication_provisioning_state": {"readonly": True}, + "granted_permissions": {"readonly": True}, + "authentication_type": {"required": True}, + "account_id": {"readonly": True}, + "aws_assume_role_arn": {"required": True}, + "aws_external_id": {"required": True}, } _attribute_map = { @@ -116,13 +116,7 @@ class AwAssumeRoleAuthenticationDetailsProperties(AuthenticationDetailsPropertie "aws_external_id": {"key": "awsExternalId", "type": "str"}, } - def __init__( - self, - *, - aws_assume_role_arn: str, - aws_external_id: str, - **kwargs - ): + def __init__(self, *, aws_assume_role_arn: str, aws_external_id: str, **kwargs): """ :keyword aws_assume_role_arn: Assumed role ID is an identifier that you can use to create temporary security credentials. Required. @@ -132,7 +126,7 @@ def __init__( :paramtype aws_external_id: str """ super().__init__(**kwargs) - self.authentication_type = 'awsAssumeRole' # type: str + self.authentication_type = "awsAssumeRole" # type: str self.account_id = None self.aws_assume_role_arn = aws_assume_role_arn self.aws_external_id = aws_external_id @@ -168,12 +162,12 @@ class AwsCredsAuthenticationDetailsProperties(AuthenticationDetailsProperties): """ _validation = { - 'authentication_provisioning_state': {'readonly': True}, - 'granted_permissions': {'readonly': True}, - 'authentication_type': {'required': True}, - 'account_id': {'readonly': True}, - 'aws_access_key_id': {'required': True}, - 'aws_secret_access_key': {'required': True}, + "authentication_provisioning_state": {"readonly": True}, + "granted_permissions": {"readonly": True}, + "authentication_type": {"required": True}, + "account_id": {"readonly": True}, + "aws_access_key_id": {"required": True}, + "aws_secret_access_key": {"required": True}, } _attribute_map = { @@ -185,13 +179,7 @@ class AwsCredsAuthenticationDetailsProperties(AuthenticationDetailsProperties): "aws_secret_access_key": {"key": "awsSecretAccessKey", "type": "str"}, } - def __init__( - self, - *, - aws_access_key_id: str, - aws_secret_access_key: str, - **kwargs - ): + def __init__(self, *, aws_access_key_id: str, aws_secret_access_key: str, **kwargs): """ :keyword aws_access_key_id: Public key element of the AWS credential object (write only). Required. @@ -201,7 +189,7 @@ def __init__( :paramtype aws_secret_access_key: str """ super().__init__(**kwargs) - self.authentication_type = 'awsCreds' # type: str + self.authentication_type = "awsCreds" # type: str self.account_id = None self.aws_access_key_id = aws_access_key_id self.aws_secret_access_key = aws_secret_access_key @@ -226,11 +214,11 @@ class CloudErrorBody(_serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { @@ -241,12 +229,8 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.code = None self.message = None @@ -269,9 +253,9 @@ class Resource(_serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { @@ -280,12 +264,8 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.id = None self.name = None @@ -314,17 +294,23 @@ class ConnectorSetting(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "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"}, - "hybrid_compute_settings": {"key": "properties.hybridComputeSettings", "type": "HybridComputeSettingsProperties"}, - "authentication_details": {"key": "properties.authenticationDetails", "type": "AuthenticationDetailsProperties"}, + "hybrid_compute_settings": { + "key": "properties.hybridComputeSettings", + "type": "HybridComputeSettingsProperties", + }, + "authentication_details": { + "key": "properties.authenticationDetails", + "type": "AuthenticationDetailsProperties", + }, } def __init__( @@ -361,7 +347,7 @@ class ConnectorSettingList(_serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -369,12 +355,7 @@ class ConnectorSettingList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.ConnectorSetting"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.ConnectorSetting"]] = None, **kwargs): """ :keyword value: List of all the cloud account connector settings. :paramtype value: list[~azure.mgmt.security.v2020_01_01_preview.models.ConnectorSetting] @@ -396,8 +377,8 @@ class ErrorAdditionalInfo(_serialization.Model): """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { @@ -405,12 +386,8 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.type = None self.info = None @@ -462,20 +439,20 @@ class GcpCredentialsDetailsProperties(AuthenticationDetailsProperties): # pylin """ _validation = { - 'authentication_provisioning_state': {'readonly': True}, - 'granted_permissions': {'readonly': True}, - 'authentication_type': {'required': True}, - 'organization_id': {'required': True}, - 'type': {'required': True}, - 'project_id': {'required': True}, - 'private_key_id': {'required': True}, - 'private_key': {'required': True}, - 'client_email': {'required': True}, - 'client_id': {'required': True}, - 'auth_uri': {'required': True}, - 'token_uri': {'required': True}, - 'auth_provider_x509_cert_url': {'required': True}, - 'client_x509_cert_url': {'required': True}, + "authentication_provisioning_state": {"readonly": True}, + "granted_permissions": {"readonly": True}, + "authentication_type": {"required": True}, + "organization_id": {"required": True}, + "type": {"required": True}, + "project_id": {"required": True}, + "private_key_id": {"required": True}, + "private_key": {"required": True}, + "client_email": {"required": True}, + "client_id": {"required": True}, + "auth_uri": {"required": True}, + "token_uri": {"required": True}, + "auth_provider_x509_cert_url": {"required": True}, + "client_x509_cert_url": {"required": True}, } _attribute_map = { @@ -538,7 +515,7 @@ def __init__( :paramtype client_x509_cert_url: str """ super().__init__(**kwargs) - self.authentication_type = 'gcpCredentials' # type: str + self.authentication_type = "gcpCredentials" # type: str self.organization_id = organization_id self.type = type self.project_id = project_id @@ -580,8 +557,8 @@ class HybridComputeSettingsProperties(_serialization.Model): """ _validation = { - 'hybrid_compute_provisioning_state': {'readonly': True}, - 'auto_provision': {'required': True}, + "hybrid_compute_provisioning_state": {"readonly": True}, + "auto_provision": {"required": True}, } _attribute_map = { @@ -643,13 +620,7 @@ class ProxyServerProperties(_serialization.Model): "port": {"key": "port", "type": "str"}, } - def __init__( - self, - *, - ip: Optional[str] = None, - port: Optional[str] = None, - **kwargs - ): + def __init__(self, *, ip: Optional[str] = None, port: Optional[str] = None, **kwargs): """ :keyword ip: Proxy server IP. :paramtype ip: str @@ -676,13 +647,7 @@ class ServicePrincipalProperties(_serialization.Model): "secret": {"key": "secret", "type": "str"}, } - def __init__( - self, - *, - application_id: Optional[str] = None, - secret: Optional[str] = None, - **kwargs - ): + def __init__(self, *, application_id: Optional[str] = None, secret: Optional[str] = None, **kwargs): """ :keyword application_id: Application ID of service principal. :paramtype application_id: str diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py index ae512c2bd2e8..9c10c4fb9804 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/models/_security_center_enums.py @@ -11,8 +11,7 @@ class AuthenticationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the multi-cloud connector. - """ + """State of the multi-cloud connector.""" #: Valid connector VALID = "Valid" @@ -23,6 +22,7 @@ class AuthenticationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMe #: Incorrect policy of the connector INCORRECT_POLICY = "IncorrectPolicy" + class AuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use account organization credentials. @@ -35,18 +35,18 @@ class AuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): #: GCP account connector service to service authentication GCP_CREDENTIALS = "gcpCredentials" + class AutoProvision(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether or not to automatically install Azure Arc (hybrid compute) agents on machines. - """ + """Whether or not to automatically install Azure Arc (hybrid compute) agents on machines.""" #: Install missing Azure Arc agents on machines automatically ON = "On" #: Do not install Azure Arc agent on the machines automatically OFF = "Off" + class HybridComputeProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """State of the service principal and its secret. - """ + """State of the service principal and its secret.""" #: Valid service principal details. VALID = "Valid" @@ -55,9 +55,9 @@ class HybridComputeProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMet #: the service principal details are expired EXPIRED = "Expired" + class PermissionProperty(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A permission detected in the cloud account. - """ + """A permission detected in the cloud account.""" #: This permission provides read only access to AWS Security Hub resources. AWS_AWS_SECURITY_HUB_READ_ONLY_ACCESS = "AWS::AWSSecurityHubReadOnlyAccess" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py index 1d6239b35b09..36717e9887ca 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'ConnectorsOperations', + "ConnectorsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py index 4f61e8839d8f..f23c32136df7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py @@ -6,10 +6,18 @@ # 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, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, map_error +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.pipeline.transport import HttpResponse @@ -21,152 +29,141 @@ from .. import models as _models from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_list_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, '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_get_request( - connector_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(connector_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - "connectorName": _SERIALIZER.url("connector_name", connector_name, 'str'), + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, '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_create_or_update_request( - connector_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request(connector_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - "connectorName": _SERIALIZER.url("connector_name", connector_name, 'str'), + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) - - -def build_delete_request( - connector_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: + _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(connector_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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}") # pylint: disable=line-too-long + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}" + ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - "connectorName": _SERIALIZER.url("connector_name", connector_name, 'str'), + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - return HttpRequest( - method="DELETE", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) class ConnectorsOperations: """ @@ -187,12 +184,8 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.ConnectorSetting"]: + def list(self, **kwargs: Any) -> Iterable["_models.ConnectorSetting"]: """Cloud accounts connectors of a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -204,20 +197,26 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectorSettingList] + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSettingList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -226,10 +225,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -246,9 +252,7 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -258,18 +262,12 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors"} # type: ignore @distributed_trace - def get( - self, - connector_name: str, - **kwargs: Any - ) -> _models.ConnectorSetting: + def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: """Details of a specific cloud account connector. :param connector_name: Name of the cloud account connector. Required. @@ -280,22 +278,26 @@ def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectorSetting] + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] - request = build_get_request( connector_name=connector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -303,9 +305,7 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -314,15 +314,14 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ConnectorSetting', pipeline_response) + deserialized = self._deserialize("ConnectorSetting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore @overload def create_or_update( @@ -352,12 +351,7 @@ def create_or_update( @overload def create_or_update( - self, - connector_name: str, - connector_setting: IO, - *, - content_type: str = "application/json", - **kwargs: Any + self, connector_name: str, connector_setting: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.ConnectorSetting: """Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either account credentials or role-based authentication. For GCP, use account @@ -376,13 +370,9 @@ def create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace def create_or_update( - self, - connector_name: str, - connector_setting: Union[_models.ConnectorSetting, IO], - **kwargs: Any + self, connector_name: str, connector_setting: Union[_models.ConnectorSetting, IO], **kwargs: Any ) -> _models.ConnectorSetting: """Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either account credentials or role-based authentication. For GCP, use account @@ -402,16 +392,21 @@ def create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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 = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectorSetting] + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectorSetting] content_type = content_type or "application/json" _json = None @@ -419,7 +414,7 @@ def create_or_update( if isinstance(connector_setting, (IO, bytes)): _content = connector_setting else: - _json = self._serialize.body(connector_setting, 'ConnectorSetting') + _json = self._serialize.body(connector_setting, "ConnectorSetting") request = build_create_or_update_request( connector_name=connector_name, @@ -428,7 +423,7 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata['url'], + template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) @@ -436,9 +431,7 @@ def create_or_update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -447,22 +440,17 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('ConnectorSetting', pipeline_response) + deserialized = self._deserialize("ConnectorSetting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore - + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, - connector_name: str, - **kwargs: Any - ) -> None: + def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements """Delete a cloud account connector from a subscription. :param connector_name: Name of the cloud account connector. Required. @@ -473,22 +461,26 @@ def delete( # pylint: disable=inconsistent-return-statements :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-01-preview")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[None] + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-01-01-preview") + ) # type: Literal["2020-01-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[None] - request = build_delete_request( connector_name=connector_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata['url'], + template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) @@ -496,9 +488,7 @@ def delete( # pylint: disable=inconsistent-return-statements request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -510,5 +500,4 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore - + delete.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py index baa6932f44d6..e26ff92bc8dd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -34,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-07-01-preview") # type: str + api_version = kwargs.pop("api_version", "2020-07-01-preview") # type: Literal["2020-07-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json index c06f42250e5b..097b59763bc9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json @@ -89,4 +89,4 @@ "sql_vulnerability_assessment_scan_results": "SqlVulnerabilityAssessmentScanResultsOperations", "sql_vulnerability_assessment_baseline_rules": "SqlVulnerabilityAssessmentBaselineRulesOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py index 0f0dead106be..b5b327f05486 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -34,7 +40,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2020-07-01-preview") # type: str + api_version = kwargs.pop("api_version", "2020-07-01-preview") # type: Literal["2020-07-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index 72e690c60f8c..3c06e26616f4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -33,6 +34,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -161,7 +166,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] @@ -238,7 +245,9 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] request = build_get_request( @@ -302,7 +311,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -358,7 +369,9 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] request = build_list_request( @@ -486,7 +499,9 @@ async def add( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py index dfcecd3efa5d..f8a77971452d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._sql_vulnerability_assessment_scan_results_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResult] request = build_get_request( @@ -147,7 +154,9 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResults] request = build_list_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py index 0fe78658a321..dd43e5060c63 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._sql_vulnerability_assessment_scans_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,7 +84,9 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Scan] request = build_get_request( @@ -139,7 +146,9 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Scans] request = build_list_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index 905599255ed4..cfa641f0db7a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_create_or_update_request(rule_id: str, resource_id: str, *, workspace_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -70,7 +77,9 @@ def build_get_request(rule_id: str, resource_id: str, *, workspace_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +108,9 @@ def build_delete_request(rule_id: str, resource_id: str, *, workspace_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +139,9 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,7 +168,9 @@ def build_add_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -305,7 +320,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] @@ -382,7 +399,9 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RuleResults] request = build_get_request( @@ -446,7 +465,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -502,7 +523,9 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] request = build_list_request( @@ -630,7 +653,9 @@ def add( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.RulesResults] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py index d51b7d0b2030..7b5825a52b1e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +77,9 @@ def build_list_request(scan_id: str, resource_id: str, *, workspace_id: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,7 +156,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResult] request = build_get_request( @@ -211,7 +222,9 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ScanResults] request = build_list_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py index 258d66847943..67b1fb530b27 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(scan_id: str, resource_id: str, *, workspace_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,9 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +146,9 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Scan] request = build_get_request( @@ -197,7 +208,9 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2020-07-01-preview") + ) # type: Literal["2020-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Scans] request = build_list_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py index dd390ea69d5f..dc619b6e3a5e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-01") # type: str + api_version = kwargs.pop("api_version", "2021-01-01") # type: Literal["2021-01-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json index 70bd35c11acc..174825493d37 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "alerts": "AlertsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py index 8d83abfa62a4..e6a65f1057b1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-01") # type: str + api_version = kwargs.pop("api_version", "2021-01-01") # type: Literal["2021-01-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py index 62f6c9cf5808..0d4651467be4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -46,6 +47,10 @@ build_update_subscription_level_state_to_resolve_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -107,10 +112,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -156,7 +168,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -183,10 +195,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -233,7 +252,7 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -260,10 +279,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -315,7 +341,7 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -343,10 +369,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -402,7 +435,7 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] request = build_get_subscription_level_request( @@ -466,7 +499,7 @@ async def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] request = build_get_resource_group_level_request( @@ -528,7 +561,7 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_dismiss_request( @@ -585,7 +618,7 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_resolve_request( @@ -642,7 +675,7 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_activate_request( @@ -702,7 +735,7 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_resolve_request( @@ -763,7 +796,7 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_dismiss_request( @@ -824,7 +857,7 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_activate_request( @@ -872,7 +905,7 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -1012,7 +1045,7 @@ async def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py index 3198d11fc790..2518d4a817ac 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/models/_models_py3.py @@ -12,13 +12,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py index 11c127f92fd6..b96170f2f9d9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +107,7 @@ def build_list_subscription_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +138,7 @@ def build_list_resource_group_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +173,7 @@ def build_get_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +206,7 @@ def build_get_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +242,7 @@ def build_update_subscription_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +275,7 @@ def build_update_subscription_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,7 +308,7 @@ def build_update_subscription_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -336,7 +341,7 @@ def build_update_resource_group_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -372,7 +377,7 @@ def build_update_resource_group_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -408,7 +413,7 @@ def build_update_resource_group_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -442,7 +447,7 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -502,7 +507,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -528,10 +533,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -577,7 +589,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -604,10 +616,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -654,7 +673,7 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -681,10 +700,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -736,7 +762,7 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -764,10 +790,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -823,7 +856,7 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] request = build_get_subscription_level_request( @@ -887,7 +920,7 @@ def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] request = build_get_resource_group_level_request( @@ -949,7 +982,7 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_dismiss_request( @@ -1006,7 +1039,7 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_resolve_request( @@ -1063,7 +1096,7 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_activate_request( @@ -1123,7 +1156,7 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_resolve_request( @@ -1184,7 +1217,7 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_dismiss_request( @@ -1245,7 +1278,7 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_activate_request( @@ -1293,7 +1326,7 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -1433,7 +1466,7 @@ def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) # type: Literal["2021-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py index ce9e3f3e8007..29eb554b4669 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-15-preview") # type: str + api_version = kwargs.pop("api_version", "2021-01-15-preview") # type: Literal["2021-01-15-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json index bd9228fe81da..44fe3aad2097 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "ingestion_settings": "IngestionSettingsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py index d6e7427866f1..ed15395c07e2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-01-15-preview") # type: str + api_version = kwargs.pop("api_version", "2021-01-15-preview") # type: Literal["2021-01-15-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py index 9f31f72e23f6..783c50fa9756 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,6 +38,10 @@ build_list_tokens_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.IngestionSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingList] error_map = { @@ -100,10 +107,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -157,7 +171,9 @@ async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Inges _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] request = build_get_request( @@ -271,7 +287,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] @@ -340,7 +358,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -392,7 +412,9 @@ async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingToken] request = build_list_tokens_request( @@ -447,7 +469,9 @@ async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectionStrings] request = build_list_connection_strings_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py index 9d03ba76fb4d..b59efd30e6fd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,9 @@ def build_get_request(ingestion_setting_name: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +105,9 @@ def build_create_request(ingestion_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -129,7 +140,9 @@ def build_delete_request(ingestion_setting_name: str, subscription_id: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +172,9 @@ def build_list_tokens_request(ingestion_setting_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -191,7 +206,9 @@ def build_list_connection_strings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -250,7 +267,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.IngestionSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingList] error_map = { @@ -276,10 +295,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -333,7 +359,9 @@ def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] request = build_get_request( @@ -447,7 +475,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSetting] @@ -516,7 +546,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -568,7 +600,9 @@ def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.Ing _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.IngestionSettingToken] request = build_list_tokens_request( @@ -623,7 +657,9 @@ def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-01-15-preview") + ) # type: Literal["2021-01-15-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ConnectionStrings] request = build_list_connection_strings_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py index 2edeed7e1a4a..3614699fc08f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-05-01-preview") # type: str + api_version = kwargs.pop("api_version", "2021-05-01-preview") # type: Literal["2021-05-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json index fc7aa567b217..51725a878d15 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "software_inventories": "SoftwareInventoriesOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py index 76ea2b1461ed..938dfefc1977 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-05-01-preview") # type: str + api_version = kwargs.pop("api_version", "2021-05-01-preview") # type: Literal["2021-05-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py index fbbd49ce806a..efd086d3f9d3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -34,6 +35,10 @@ build_list_by_subscription_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,9 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-05-01-preview") + ) # type: Literal["2021-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] error_map = { @@ -111,10 +118,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -158,7 +172,9 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Software _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-05-01-preview") + ) # type: Literal["2021-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] error_map = { @@ -184,10 +200,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -257,7 +280,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-05-01-preview") + ) # type: Literal["2021-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Software] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py index 0294edbdf2a0..1cb5f3c1fad4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,9 @@ def build_list_by_extended_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-05-01-preview") + ) # type: Literal["2021-05-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +89,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-05-01-preview") + ) # type: Literal["2021-05-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +127,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-05-01-preview") + ) # type: Literal["2021-05-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +203,9 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-05-01-preview") + ) # type: Literal["2021-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] error_map = { @@ -222,10 +235,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -268,7 +288,9 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Software"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-05-01-preview") + ) # type: Literal["2021-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SoftwaresList] error_map = { @@ -294,10 +316,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -367,7 +396,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-05-01-preview") + ) # type: Literal["2021-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Software] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py index 2c64b122657d..a751a5a17000 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-06-01") # type: str + api_version = kwargs.pop("api_version", "2021-06-01") # type: Literal["2021-06-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json index 81f23729b9f8..79bc9c66c629 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json @@ -101,4 +101,4 @@ "assessments_metadata": "AssessmentsMetadataOperations", "assessments": "AssessmentsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py index ee2313700217..dd03c6205884 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-06-01") # type: str + api_version = kwargs.pop("api_version", "2021-06-01") # type: Literal["2021-06-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py index ff042194632d..dcb5a52502f5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,6 +38,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetada _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] error_map = { @@ -99,10 +104,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -156,7 +168,7 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] request = build_get_request( @@ -202,7 +214,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Security _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] error_map = { @@ -228,10 +240,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -287,7 +306,7 @@ async def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] request = build_get_in_subscription_request( @@ -406,7 +425,7 @@ async def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] @@ -477,7 +496,7 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_in_subscription_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py index 5a0c45d7392c..c212a1adcd27 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,7 +81,7 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.SecurityAsse _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] error_map = { @@ -102,10 +107,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -141,7 +153,7 @@ async def get( self, resource_id: str, assessment_name: str, - expand: Optional[Union[str, "_models.ExpandEnum"]] = None, + expand: Optional[Union[str, _models.ExpandEnum]] = None, **kwargs: Any ) -> _models.SecurityAssessmentResponse: """Get a security assessment on your scanned resource. @@ -169,7 +181,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] request = build_get_request( @@ -292,7 +304,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] @@ -368,7 +380,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py index 1d64162e8cd8..a26ac7f2970e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._settings_operations import build_get_request, build_list_request, build_update_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] error_map = { @@ -92,10 +97,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -127,7 +139,7 @@ async def get_next(next_link=None): list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore @distributed_trace_async - async def get(self, setting_name: Union[str, "_models.Enum1"], **kwargs: Any) -> _models.Setting: + async def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models.Setting: """Settings of different configurations in Microsoft Defender for Cloud. :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", and @@ -149,7 +161,7 @@ async def get(self, setting_name: Union[str, "_models.Enum1"], **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] request = build_get_request( @@ -185,7 +197,7 @@ async def get(self, setting_name: Union[str, "_models.Enum1"], **kwargs: Any) -> @overload async def update( self, - setting_name: Union[str, "_models.Enum1"], + setting_name: Union[str, _models.Enum1], setting: _models.Setting, *, content_type: str = "application/json", @@ -210,7 +222,7 @@ async def update( @overload async def update( self, - setting_name: Union[str, "_models.Enum1"], + setting_name: Union[str, _models.Enum1], setting: IO, *, content_type: str = "application/json", @@ -234,7 +246,7 @@ async def update( @distributed_trace_async async def update( - self, setting_name: Union[str, "_models.Enum1"], setting: Union[_models.Setting, IO], **kwargs: Any + self, setting_name: Union[str, _models.Enum1], setting: Union[_models.Setting, IO], **kwargs: Any ) -> _models.Setting: """updating settings about different configurations in Microsoft Defender for Cloud. @@ -262,7 +274,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py index f9a775ac640c..adb88f6af608 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +64,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +88,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +116,7 @@ def build_get_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +148,7 @@ def build_create_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -178,7 +183,7 @@ def build_delete_in_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +242,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadataRes _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] error_map = { @@ -262,10 +267,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -319,7 +331,7 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] request = build_get_request( @@ -365,7 +377,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SecurityAsses _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponseList] error_map = { @@ -391,10 +403,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -450,7 +469,7 @@ def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] request = build_get_in_subscription_request( @@ -569,7 +588,7 @@ def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentMetadataResponse] @@ -640,7 +659,7 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_in_subscription_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py index 9d5d560597f4..1c27f11a49ec 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,12 +66,12 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: def build_get_request( - resource_id: str, assessment_name: str, *, expand: Optional[Union[str, "_models.ExpandEnum"]] = None, **kwargs: Any + resource_id: str, assessment_name: str, *, expand: Optional[Union[str, _models.ExpandEnum]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +98,7 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -121,7 +126,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,7 +184,7 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.SecurityAssessmen _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentList] error_map = { @@ -205,10 +210,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -244,7 +256,7 @@ def get( self, resource_id: str, assessment_name: str, - expand: Optional[Union[str, "_models.ExpandEnum"]] = None, + expand: Optional[Union[str, _models.ExpandEnum]] = None, **kwargs: Any ) -> _models.SecurityAssessmentResponse: """Get a security assessment on your scanned resource. @@ -272,7 +284,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] request = build_get_request( @@ -395,7 +407,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityAssessmentResponse] @@ -471,7 +483,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py index 05e09fb0d79b..bb9185702e90 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,11 +67,11 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request(setting_name: Union[str, "_models.Enum1"], subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_get_request(setting_name: Union[str, _models.Enum1], subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,11 +96,11 @@ def build_get_request(setting_name: Union[str, "_models.Enum1"], subscription_id return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request(setting_name: Union[str, "_models.Enum1"], subscription_id: str, **kwargs: Any) -> HttpRequest: +def build_update_request(setting_name: Union[str, _models.Enum1], subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -154,7 +159,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] error_map = { @@ -180,10 +185,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -215,7 +227,7 @@ def get_next(next_link=None): list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore @distributed_trace - def get(self, setting_name: Union[str, "_models.Enum1"], **kwargs: Any) -> _models.Setting: + def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models.Setting: """Settings of different configurations in Microsoft Defender for Cloud. :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", and @@ -237,7 +249,7 @@ def get(self, setting_name: Union[str, "_models.Enum1"], **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] request = build_get_request( @@ -273,7 +285,7 @@ def get(self, setting_name: Union[str, "_models.Enum1"], **kwargs: Any) -> _mode @overload def update( self, - setting_name: Union[str, "_models.Enum1"], + setting_name: Union[str, _models.Enum1], setting: _models.Setting, *, content_type: str = "application/json", @@ -298,7 +310,7 @@ def update( @overload def update( self, - setting_name: Union[str, "_models.Enum1"], + setting_name: Union[str, _models.Enum1], setting: IO, *, content_type: str = "application/json", @@ -322,7 +334,7 @@ def update( @distributed_trace def update( - self, setting_name: Union[str, "_models.Enum1"], setting: Union[_models.Setting, IO], **kwargs: Any + self, setting_name: Union[str, _models.Enum1], setting: Union[_models.Setting, IO], **kwargs: Any ) -> _models.Setting: """updating settings about different configurations in Microsoft Defender for Cloud. @@ -350,7 +362,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) # type: Literal["2021-06-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py index 155cb1fc508d..9194a3328c1b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01") # type: str + api_version = kwargs.pop("api_version", "2021-07-01") # type: Literal["2021-07-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json index 7af577e25640..efc901abd95d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "settings": "SettingsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py index 23906b4c7b04..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/__init__.py @@ -14,7 +14,10 @@ except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ['SecurityCenter'] + +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py index 47769728fec2..f3efe1774dd1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -34,14 +40,9 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in :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: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-07-01") # type: str + api_version = kwargs.pop("api_version", "2021-07-01") # type: Literal["2021-07-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -51,22 +52,21 @@ def __init__( 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-security/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-security/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_patch.py @@ -10,6 +10,7 @@ __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. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py index 52e32fbdc75d..de5852103e68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py @@ -21,6 +21,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential + class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword """API spec for Microsoft.Security (Azure Security Center) resource provider. @@ -51,16 +52,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.settings = SettingsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - + self.settings = SettingsOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py index 01945c743c92..0b0925b026d7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'SettingsOperations', + "SettingsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_patch.py @@ -10,6 +10,7 @@ __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. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py index 889a00b26719..fa070305ec9f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py @@ -6,11 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +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.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest @@ -22,9 +30,15 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._settings_operations import build_get_request, build_list_request, build_update_request -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + class SettingsOperations: """ .. warning:: @@ -44,12 +58,8 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.Setting"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: """Settings about different configurations in Microsoft Defender for Cloud. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,20 +71,24 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SettingsList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -83,10 +97,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -103,9 +124,7 @@ async def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -115,18 +134,12 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged(get_next, extract_data) - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore @distributed_trace_async - async def get( - self, - setting_name: Union[str, "_models.SettingName"], - **kwargs: Any - ) -> _models.Setting: + async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: """Settings of different configurations in Microsoft Defender for Cloud. :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", @@ -138,22 +151,24 @@ async def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Setting] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] - request = build_get_request( setting_name=setting_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -161,9 +176,7 @@ async def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -172,20 +185,19 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Setting', pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore @overload async def update( self, - setting_name: Union[str, "_models.SettingName"], + setting_name: Union[str, _models.SettingName], setting: _models.Setting, *, content_type: str = "application/json", @@ -210,7 +222,7 @@ async def update( @overload async def update( self, - setting_name: Union[str, "_models.SettingName"], + setting_name: Union[str, _models.SettingName], setting: IO, *, content_type: str = "application/json", @@ -232,13 +244,9 @@ async def update( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async async def update( - self, - setting_name: Union[str, "_models.SettingName"], - setting: Union[_models.Setting, IO], - **kwargs: Any + self, setting_name: Union[str, _models.SettingName], setting: Union[_models.Setting, IO], **kwargs: Any ) -> _models.Setting: """updating settings about different configurations in Microsoft Defender for Cloud. @@ -256,16 +264,19 @@ async def update( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Setting] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] content_type = content_type or "application/json" _json = None @@ -273,7 +284,7 @@ async def update( if isinstance(setting, (IO, bytes)): _content = setting else: - _json = self._serialize.body(setting, 'Setting') + _json = self._serialize.body(setting, "Setting") request = build_update_request( setting_name=setting_name, @@ -282,7 +293,7 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata['url'], + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -290,9 +301,7 @@ async def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -301,12 +310,11 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Setting', pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py index 8d9111d57a50..63e5f8c91733 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/__init__.py @@ -19,16 +19,17 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'AlertSyncSettings', - 'CloudErrorBody', - 'DataExportSettings', - 'ErrorAdditionalInfo', - 'Resource', - 'Setting', - 'SettingsList', - 'SettingKind', - 'SettingName', + "AlertSyncSettings", + "CloudErrorBody", + "DataExportSettings", + "ErrorAdditionalInfo", + "Resource", + "Setting", + "SettingsList", + "SettingKind", + "SettingName", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py index 84c7b1d9b217..614e2db39baa 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_models_py3.py @@ -26,9 +26,9 @@ class Resource(_serialization.Model): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { @@ -37,12 +37,8 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.id = None self.name = None @@ -71,10 +67,10 @@ class Setting(Resource): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kind": {"required": True}, } _attribute_map = { @@ -84,16 +80,10 @@ class Setting(Resource): "kind": {"key": "kind", "type": "str"}, } - _subtype_map = { - 'kind': {'AlertSyncSettings': 'AlertSyncSettings', 'DataExportSettings': 'DataExportSettings'} - } + _subtype_map = {"kind": {"AlertSyncSettings": "AlertSyncSettings", "DataExportSettings": "DataExportSettings"}} - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.kind = None # type: Optional[str] @@ -119,10 +109,10 @@ class AlertSyncSettings(Setting): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kind": {"required": True}, } _attribute_map = { @@ -133,18 +123,13 @@ class AlertSyncSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Is the alert sync setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = 'AlertSyncSettings' # type: str + self.kind = "AlertSyncSettings" # type: str self.enabled = enabled @@ -166,11 +151,11 @@ class CloudErrorBody(_serialization.Model): """ _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, } _attribute_map = { @@ -181,12 +166,8 @@ class CloudErrorBody(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.code = None self.message = None @@ -216,10 +197,10 @@ class DataExportSettings(Setting): """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kind": {"required": True}, } _attribute_map = { @@ -230,18 +211,13 @@ class DataExportSettings(Setting): "enabled": {"key": "properties.enabled", "type": "bool"}, } - def __init__( - self, - *, - enabled: Optional[bool] = None, - **kwargs - ): + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): """ :keyword enabled: Is the data export setting enabled. :paramtype enabled: bool """ super().__init__(**kwargs) - self.kind = 'DataExportSettings' # type: str + self.kind = "DataExportSettings" # type: str self.enabled = enabled @@ -257,8 +233,8 @@ class ErrorAdditionalInfo(_serialization.Model): """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + "type": {"readonly": True}, + "info": {"readonly": True}, } _attribute_map = { @@ -266,12 +242,8 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__( - self, - **kwargs - ): - """ - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) self.type = None self.info = None @@ -289,7 +261,7 @@ class SettingsList(_serialization.Model): """ _validation = { - 'next_link': {'readonly': True}, + "next_link": {"readonly": True}, } _attribute_map = { @@ -297,12 +269,7 @@ class SettingsList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - value: Optional[List["_models.Setting"]] = None, - **kwargs - ): + def __init__(self, *, value: Optional[List["_models.Setting"]] = None, **kwargs): """ :keyword value: The settings list. :paramtype value: list[~azure.mgmt.security.v2021_07_01.models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_patch.py @@ -10,6 +10,7 @@ __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. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_security_center_enums.py index 72f139849430..a8c079d4a92a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/models/_security_center_enums.py @@ -11,16 +11,15 @@ class SettingKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the kind of the settings string. - """ + """the kind of the settings string.""" DATA_EXPORT_SETTINGS = "DataExportSettings" ALERT_SUPPRESSION_SETTING = "AlertSuppressionSetting" ALERT_SYNC_SETTINGS = "AlertSyncSettings" + class SettingName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SettingName. - """ + """SettingName.""" MCAS = "MCAS" WDATP = "WDATP" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py index 01945c743c92..0b0925b026d7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/__init__.py @@ -11,8 +11,9 @@ from ._patch import __all__ as _patch_all from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk + __all__ = [ - 'SettingsOperations', + "SettingsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() \ No newline at end of file +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_patch.py index 0ad201a8c586..f7dd32510333 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_patch.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_patch.py @@ -10,6 +10,7 @@ __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. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py index e01603d019b7..e5e076466b76 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py @@ -6,10 +6,18 @@ # 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, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, map_error +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.pipeline.transport import HttpResponse @@ -21,117 +29,108 @@ from .. import models as _models from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: +def build_list_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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, '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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( - setting_name: Union[str, "_models.SettingName"], - subscription_id: str, - **kwargs: Any + setting_name: Union[str, _models.SettingName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - "settingName": _SERIALIZER.url("setting_name", setting_name, 'str'), + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, '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 - ) + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_update_request( - setting_name: Union[str, "_models.SettingName"], - subscription_id: str, - **kwargs: Any + setting_name: Union[str, _models.SettingName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - accept = _headers.pop('Accept', "application/json") + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}") + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}" + ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$'), - "settingName": _SERIALIZER.url("setting_name", setting_name, 'str'), + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers if content_type is not None: - _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_params, - headers=_headers, - **kwargs - ) + _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) + class SettingsOperations: """ @@ -152,12 +151,8 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.Setting"]: + def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: """Settings about different configurations in Microsoft Defender for Cloud. :keyword callable cls: A custom type or function that will be passed the direct response @@ -168,20 +163,24 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.SettingsList] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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, api_version=api_version, - template_url=self.list.metadata['url'], + template_url=self.list.metadata["url"], headers=_headers, params=_params, ) @@ -190,10 +189,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -210,9 +216,7 @@ def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -222,18 +226,12 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged(get_next, extract_data) - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore @distributed_trace - def get( - self, - setting_name: Union[str, "_models.SettingName"], - **kwargs: Any - ) -> _models.Setting: + def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: """Settings of different configurations in Microsoft Defender for Cloud. :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", @@ -245,22 +243,24 @@ def get( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - cls = kwargs.pop('cls', None) # type: ClsType[_models.Setting] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] - request = build_get_request( setting_name=setting_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata['url'], + template_url=self.get.metadata["url"], headers=_headers, params=_params, ) @@ -268,9 +268,7 @@ def get( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -279,20 +277,19 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Setting', pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore - + get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore @overload def update( self, - setting_name: Union[str, "_models.SettingName"], + setting_name: Union[str, _models.SettingName], setting: _models.Setting, *, content_type: str = "application/json", @@ -317,7 +314,7 @@ def update( @overload def update( self, - setting_name: Union[str, "_models.SettingName"], + setting_name: Union[str, _models.SettingName], setting: IO, *, content_type: str = "application/json", @@ -339,13 +336,9 @@ def update( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace def update( - self, - setting_name: Union[str, "_models.SettingName"], - setting: Union[_models.Setting, IO], - **kwargs: Any + self, setting_name: Union[str, _models.SettingName], setting: Union[_models.Setting, IO], **kwargs: Any ) -> _models.Setting: """updating settings about different configurations in Microsoft Defender for Cloud. @@ -363,16 +356,19 @@ def update( :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - error_map.update(kwargs.pop('error_map', {}) or {}) + 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 = kwargs.pop('api_version', _params.pop('api-version', "2021-07-01")) # type: str - content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] - cls = kwargs.pop('cls', None) # type: ClsType[_models.Setting] + api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) # type: Literal["2021-07-01"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] content_type = content_type or "application/json" _json = None @@ -380,7 +376,7 @@ def update( if isinstance(setting, (IO, bytes)): _content = setting else: - _json = self._serialize.body(setting, 'Setting') + _json = self._serialize.body(setting, "Setting") request = build_update_request( setting_name=setting_name, @@ -389,7 +385,7 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata['url'], + template_url=self.update.metadata["url"], headers=_headers, params=_params, ) @@ -397,9 +393,7 @@ def update( request.url = self._client.format_url(request.url) # type: ignore pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, - stream=False, - **kwargs + request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -408,12 +402,11 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('Setting', pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore - + update.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py index 714068a4b542..ff11a8f61b7d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01-preview") # type: str + api_version = kwargs.pop("api_version", "2021-07-01-preview") # type: Literal["2021-07-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json index 2015959c3b7d..374729f3205b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json @@ -101,4 +101,4 @@ "custom_entity_store_assignments": "CustomEntityStoreAssignmentsOperations", "security_connectors": "SecurityConnectorsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py index b0462e45160b..5e96849ba4bc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-07-01-preview") # type: str + api_version = kwargs.pop("api_version", "2021-07-01-preview") # type: Literal["2021-07-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py index 585dfcbc859d..1a0c4fffaf31 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_list_by_subscription_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +94,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] request = build_get_request( @@ -227,7 +234,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] @@ -306,7 +315,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -357,7 +368,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] error_map = { @@ -384,10 +397,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -434,7 +454,9 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomAs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] error_map = { @@ -460,10 +482,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py index a9fe177172c9..389ec974975e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_list_by_subscription_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +95,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] request = build_get_request( @@ -230,7 +237,9 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] @@ -312,7 +321,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -363,7 +374,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] error_map = { @@ -390,10 +403,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -440,7 +460,9 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomEn _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] error_map = { @@ -466,10 +488,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py index c0d9bfb3065a..cbdaa5a77d2b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,6 +38,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] error_map = { @@ -100,10 +107,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -153,7 +167,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] error_map = { @@ -180,10 +196,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -241,7 +264,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] request = build_get_request( @@ -372,7 +397,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] @@ -516,7 +543,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] @@ -589,7 +618,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py index 254265a277db..69b42c942dcd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +86,9 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -119,7 +128,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +165,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,7 +199,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -259,7 +274,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] request = build_get_request( @@ -397,7 +414,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomation] @@ -476,7 +495,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -527,7 +548,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] error_map = { @@ -554,10 +577,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -604,7 +634,9 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomAssessm _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomAssessmentAutomationsListResult] error_map = { @@ -630,10 +662,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py index 0e9d94806012..e1ec5f2bdfaf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +86,9 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -119,7 +128,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +165,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,7 +199,9 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -260,7 +275,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] request = build_get_request( @@ -400,7 +417,9 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignment] @@ -482,7 +501,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -533,7 +554,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] error_map = { @@ -560,10 +583,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -610,7 +640,9 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomEntityS _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.CustomEntityStoreAssignmentsListResult] error_map = { @@ -636,10 +668,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py index adf7ec313285..ad867e4287d4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +146,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -173,7 +186,9 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -211,7 +226,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -273,7 +290,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] error_map = { @@ -299,10 +318,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -350,7 +376,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] error_map = { @@ -377,10 +405,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -436,7 +471,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] request = build_get_request( @@ -567,7 +604,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] @@ -711,7 +750,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] @@ -784,7 +825,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-07-01-preview") + ) # type: Literal["2021-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py index 9ba3aef7e095..9c10b6b87859 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-10-01-preview") # type: str + api_version = kwargs.pop("api_version", "2021-10-01-preview") # type: Literal["2021-10-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json index bc03b8f1af89..99191c265762 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "mde_onboardings": "MdeOnboardingsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py index a43daaba3c26..bf874fb09566 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-10-01-preview") # type: str + api_version = kwargs.pop("api_version", "2021-10-01-preview") # type: Literal["2021-10-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py index 383ddcf63230..5ade8af29984 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._mde_onboardings_operations import build_get_request, build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,9 @@ async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-10-01-preview") + ) # type: Literal["2021-10-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingDataList] request = build_list_request( @@ -122,7 +129,9 @@ async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-10-01-preview") + ) # type: Literal["2021-10-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingData] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py index 4ffb49310b2a..537642b6028f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-10-01-preview") + ) # type: Literal["2021-10-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +71,9 @@ def build_get_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 = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-10-01-preview") + ) # type: Literal["2021-10-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +136,9 @@ def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-10-01-preview") + ) # type: Literal["2021-10-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingDataList] request = build_list_request( @@ -179,7 +190,9 @@ def get(self, **kwargs: Any) -> _models.MdeOnboardingData: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2021-10-01-preview") + ) # type: Literal["2021-10-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.MdeOnboardingData] request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py index 7c99034369bd..f82e49827e0f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01") # type: str + api_version = kwargs.pop("api_version", "2022-01-01") # type: Literal["2022-01-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json index a08d93e4fed4..d019af3e33e5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "alerts": "AlertsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py index 48c513514766..2959d8611ba3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01") # type: str + api_version = kwargs.pop("api_version", "2022-01-01") # type: Literal["2022-01-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py index c991510c66b6..5322d47bdfc7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -48,6 +49,10 @@ build_update_subscription_level_state_to_resolve_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +88,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -109,10 +114,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -158,7 +170,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -185,10 +197,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -235,7 +254,7 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -262,10 +281,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -317,7 +343,7 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -345,10 +371,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -404,7 +437,7 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] request = build_get_subscription_level_request( @@ -468,7 +501,7 @@ async def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] request = build_get_resource_group_level_request( @@ -530,7 +563,7 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_dismiss_request( @@ -587,7 +620,7 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_resolve_request( @@ -644,7 +677,7 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_activate_request( @@ -701,7 +734,7 @@ async def update_subscription_level_state_to_in_progress( # pylint: disable=inc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_in_progress_request( @@ -761,7 +794,7 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_resolve_request( @@ -822,7 +855,7 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_dismiss_request( @@ -883,7 +916,7 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_activate_request( @@ -944,7 +977,7 @@ async def update_resource_group_level_state_to_in_progress( # pylint: disable=i _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_in_progress_request( @@ -992,7 +1025,7 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -1132,7 +1165,7 @@ async def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py index c5c96fecb209..d06450ef6ea1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/models/_models_py3.py @@ -12,13 +12,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py index 31f080e24b54..8b4e64307f33 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +73,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +107,7 @@ def build_list_subscription_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +138,7 @@ def build_list_resource_group_level_by_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +173,7 @@ def build_get_subscription_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,7 +206,7 @@ def build_get_resource_group_level_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +242,7 @@ def build_update_subscription_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,7 +275,7 @@ def build_update_subscription_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,7 +308,7 @@ def build_update_subscription_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -336,7 +341,7 @@ def build_update_subscription_level_state_to_in_progress_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -369,7 +374,7 @@ def build_update_resource_group_level_state_to_resolve_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -405,7 +410,7 @@ def build_update_resource_group_level_state_to_dismiss_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -441,7 +446,7 @@ def build_update_resource_group_level_state_to_activate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -477,7 +482,7 @@ def build_update_resource_group_level_state_to_in_progress_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -511,7 +516,7 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -571,7 +576,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -597,10 +602,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -646,7 +658,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -673,10 +685,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -723,7 +742,7 @@ def list_subscription_level_by_region(self, asc_location: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -750,10 +769,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -805,7 +831,7 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.AlertList] error_map = { @@ -833,10 +859,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -892,7 +925,7 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] request = build_get_subscription_level_request( @@ -956,7 +989,7 @@ def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Alert] request = build_get_resource_group_level_request( @@ -1018,7 +1051,7 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_dismiss_request( @@ -1075,7 +1108,7 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_resolve_request( @@ -1132,7 +1165,7 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_activate_request( @@ -1189,7 +1222,7 @@ def update_subscription_level_state_to_in_progress( # pylint: disable=inconsist _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_subscription_level_state_to_in_progress_request( @@ -1249,7 +1282,7 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_resolve_request( @@ -1310,7 +1343,7 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_dismiss_request( @@ -1371,7 +1404,7 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_activate_request( @@ -1432,7 +1465,7 @@ def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsi _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_update_resource_group_level_state_to_in_progress_request( @@ -1480,7 +1513,7 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -1620,7 +1653,7 @@ def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) # type: Literal["2022-01-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py index d935bb0a9c2c..d57df2945327 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01-preview") # type: str + api_version = kwargs.pop("api_version", "2022-01-01-preview") # type: Literal["2022-01-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json index 0131c6bfb537..557420da04a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json @@ -105,4 +105,4 @@ "security_connector_governance_rules_execute_status": "SecurityConnectorGovernanceRulesExecuteStatusOperations", "governance_assignments": "GovernanceAssignmentsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py index b48439528e8a..b57abce4011b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-01-01-preview") # type: str + api_version = kwargs.pop("api_version", "2022-01-01-preview") # type: Literal["2022-01-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py index 430ad91d4585..7be4f81e6edc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_list_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,9 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignmentsList] error_map = { @@ -105,10 +112,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -170,7 +184,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] request = build_get_request( @@ -314,7 +330,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] @@ -395,7 +413,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rule_operations.py index 5d04e4554851..2927ce84c770 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rule_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rule_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._governance_rule_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.GovernanceRule"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] error_map = { @@ -91,10 +98,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py index 3b76adc5dc19..d0f4a162976f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -35,6 +36,10 @@ build_rule_id_execute_single_subscription_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +86,9 @@ async def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] request = build_get_request( @@ -190,7 +197,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] @@ -262,7 +271,9 @@ async def delete(self, rule_id: str, **kwargs: Any) -> None: # pylint: disable= _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -308,7 +319,9 @@ async def _rule_id_execute_single_subscription_initial( # pylint: disable=incon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -456,7 +469,9 @@ async def begin_rule_id_execute_single_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] @@ -515,7 +530,9 @@ async def _rule_id_execute_single_security_connector_initial( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -686,7 +703,9 @@ async def begin_rule_id_execute_single_security_connector( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py index bb12d35eae6f..b7e5ea958c44 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._security_connector_governance_rule_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +77,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] error_map = { @@ -100,10 +107,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_execute_status_operations.py index 51ac3f92d41f..f11ac5a5538a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_execute_status_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_execute_status_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._security_connector_governance_rules_execute_status_operations import build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +71,9 @@ async def _get_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] request = build_get_request( @@ -143,7 +150,9 @@ async def begin_get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_operations.py index 42a6c6cf62b0..8446d9e5c7d3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rules_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,6 +32,10 @@ build_get_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] request = build_get_request( @@ -224,7 +231,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] @@ -305,7 +314,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_subscription_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_subscription_governance_rules_execute_status_operations.py index 2457fb599e29..792b2aacd816 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_subscription_governance_rules_execute_status_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_subscription_governance_rules_execute_status_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._subscription_governance_rules_execute_status_operations import build_get_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +69,9 @@ async def _get_initial(self, rule_id: str, operation_id: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] request = build_get_request( @@ -134,7 +141,9 @@ async def begin_get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py index e497eb1226e1..576f80d26382 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py index 53a97bc4e782..b5e0bcae48b5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +74,9 @@ def build_get_request(scope: str, assessment_name: str, assignment_key: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +105,9 @@ def build_create_or_update_request(scope: str, assessment_name: str, assignment_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -127,7 +138,9 @@ def build_create_or_update_request(scope: str, assessment_name: str, assignment_ def build_delete_request(scope: str, assessment_name: str, assignment_key: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] # Construct URL _url = kwargs.pop( "template_url", @@ -186,7 +199,9 @@ def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignmentsList] error_map = { @@ -213,10 +228,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -276,7 +298,9 @@ def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] request = build_get_request( @@ -420,7 +444,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceAssignment] @@ -501,7 +527,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rule_operations.py index a40b91e86c79..79400be6e24d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rule_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rule_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +101,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.GovernanceRule"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] error_map = { @@ -120,10 +129,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py index 7589397cd906..3871d0f36948 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request(rule_id: str, subscription_id: str, **kwargs: Any) -> Http _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +76,9 @@ def build_create_or_update_request(rule_id: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -100,7 +109,9 @@ def build_create_or_update_request(rule_id: str, subscription_id: str, **kwargs: def build_delete_request(rule_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}" @@ -124,7 +135,9 @@ def build_rule_id_execute_single_subscription_request(rule_id: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -158,7 +171,9 @@ def build_rule_id_execute_single_security_connector_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -233,7 +248,9 @@ def get(self, rule_id: str, **kwargs: Any) -> _models.GovernanceRule: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] request = build_get_request( @@ -342,7 +359,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] @@ -414,7 +433,9 @@ def delete(self, rule_id: str, **kwargs: Any) -> None: # pylint: disable=incons _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( @@ -460,7 +481,9 @@ def _rule_id_execute_single_subscription_initial( # pylint: disable=inconsisten _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -608,7 +631,9 @@ def begin_rule_id_execute_single_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] @@ -667,7 +692,9 @@ def _rule_id_execute_single_security_connector_initial( # pylint: disable=incon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] @@ -838,7 +865,9 @@ def begin_rule_id_execute_single_security_connector( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[None] polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rule_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rule_operations.py index 23ea81aac1d8..3c1dbacd1a65 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rule_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rule_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +117,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRuleList] error_map = { @@ -138,10 +147,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_execute_status_operations.py index 0fb8ca6213b2..506e10ad39a4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_execute_status_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_execute_status_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +118,9 @@ def _get_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] request = build_get_request( @@ -188,7 +197,9 @@ def begin_get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_operations.py index be077427e69a..2df8e4d1fa94 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_security_connector_governance_rules_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +83,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -114,7 +123,9 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] # Construct URL _url = kwargs.pop( "template_url", @@ -188,7 +199,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] request = build_get_request( @@ -328,7 +341,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.GovernanceRule] @@ -409,7 +424,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_subscription_governance_rules_execute_status_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_subscription_governance_rules_execute_status_operations.py index 8b3fbc640455..cc18a6fa6af6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_subscription_governance_rules_execute_status_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_subscription_governance_rules_execute_status_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request(rule_id: str, operation_id: str, subscription_id: str, **k _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +105,9 @@ def _get_initial(self, rule_id: str, operation_id: str, **kwargs: Any) -> Option _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ExecuteRuleStatus]] request = build_get_request( @@ -166,7 +175,9 @@ def begin_get(self, rule_id: str, operation_id: str, **kwargs: Any) -> LROPoller _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-01-01-preview") + ) # type: Literal["2022-01-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ExecuteRuleStatus] polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py index 895772758283..1f9210f091e9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-03-01") # type: str + api_version = kwargs.pop("api_version", "2022-03-01") # type: Literal["2022-03-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json index d2a08a219eb1..89b310cffc2b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "pricings": "PricingsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py index 0891dd9909ef..f46270fe370c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-03-01") # type: str + api_version = kwargs.pop("api_version", "2022-03-01") # type: Literal["2022-03-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py index 9c67eb02dd39..f7139469b6e8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._pricings_operations import build_get_request, build_list_request, build_update_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] request = build_list_request( @@ -124,7 +129,7 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] request = build_get_request( @@ -222,7 +227,7 @@ async def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py index e3f2efbd83ce..ae0053fbc7f8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +69,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +98,7 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -160,7 +165,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.PricingList] request = build_list_request( @@ -214,7 +219,7 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] request = build_get_request( @@ -312,7 +317,7 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO], **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) # type: Literal["2022-03-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Pricing] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py index 1c87690036fc..cc031b97ea90 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01") # type: str + api_version = kwargs.pop("api_version", "2022-05-01") # type: Literal["2022-05-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json index d0385d6b4c72..47a3ee3d7feb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "settings": "SettingsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py index a88122f482d3..74da18d1fbd7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01") # type: str + api_version = kwargs.pop("api_version", "2022-05-01") # type: Literal["2022-05-01"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py index c5f5021f56ec..fc65f030d9dd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._settings_operations import build_get_request, build_list_request, build_update_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] error_map = { @@ -92,10 +97,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -127,7 +139,7 @@ async def get_next(next_link=None): list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore @distributed_trace_async - async def get(self, setting_name: Union[str, "_models.SettingName"], **kwargs: Any) -> _models.Setting: + async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: """Settings of different configurations in Microsoft Defender for Cloud. :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", @@ -149,7 +161,7 @@ async def get(self, setting_name: Union[str, "_models.SettingName"], **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] request = build_get_request( @@ -185,7 +197,7 @@ async def get(self, setting_name: Union[str, "_models.SettingName"], **kwargs: A @overload async def update( self, - setting_name: Union[str, "_models.SettingName"], + setting_name: Union[str, _models.SettingName], setting: _models.Setting, *, content_type: str = "application/json", @@ -210,7 +222,7 @@ async def update( @overload async def update( self, - setting_name: Union[str, "_models.SettingName"], + setting_name: Union[str, _models.SettingName], setting: IO, *, content_type: str = "application/json", @@ -234,7 +246,7 @@ async def update( @distributed_trace_async async def update( - self, setting_name: Union[str, "_models.SettingName"], setting: Union[_models.Setting, IO], **kwargs: Any + self, setting_name: Union[str, _models.SettingName], setting: Union[_models.Setting, IO], **kwargs: Any ) -> _models.Setting: """updating settings about different configurations in Microsoft Defender for Cloud. @@ -262,7 +274,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py index 192309fc7ed9..9bfd1bb6817b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,12 +68,12 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: def build_get_request( - setting_name: Union[str, "_models.SettingName"], subscription_id: str, **kwargs: Any + setting_name: Union[str, _models.SettingName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,12 +99,12 @@ def build_get_request( def build_update_request( - setting_name: Union[str, "_models.SettingName"], subscription_id: str, **kwargs: Any + setting_name: Union[str, _models.SettingName], subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -158,7 +163,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SettingsList] error_map = { @@ -184,10 +189,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -219,7 +231,7 @@ def get_next(next_link=None): list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings"} # type: ignore @distributed_trace - def get(self, setting_name: Union[str, "_models.SettingName"], **kwargs: Any) -> _models.Setting: + def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _models.Setting: """Settings of different configurations in Microsoft Defender for Cloud. :param setting_name: The name of the setting. Known values are: "MCAS", "WDATP", @@ -241,7 +253,7 @@ def get(self, setting_name: Union[str, "_models.SettingName"], **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] request = build_get_request( @@ -277,7 +289,7 @@ def get(self, setting_name: Union[str, "_models.SettingName"], **kwargs: Any) -> @overload def update( self, - setting_name: Union[str, "_models.SettingName"], + setting_name: Union[str, _models.SettingName], setting: _models.Setting, *, content_type: str = "application/json", @@ -302,7 +314,7 @@ def update( @overload def update( self, - setting_name: Union[str, "_models.SettingName"], + setting_name: Union[str, _models.SettingName], setting: IO, *, content_type: str = "application/json", @@ -326,7 +338,7 @@ def update( @distributed_trace def update( - self, setting_name: Union[str, "_models.SettingName"], setting: Union[_models.Setting, IO], **kwargs: Any + self, setting_name: Union[str, _models.SettingName], setting: Union[_models.Setting, IO], **kwargs: Any ) -> _models.Setting: """updating settings about different configurations in Microsoft Defender for Cloud. @@ -354,7 +366,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: str + api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) # type: Literal["2022-05-01"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Setting] diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py index 88208ce0c457..28502606ce6d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01-preview") # type: str + api_version = kwargs.pop("api_version", "2022-05-01-preview") # type: Literal["2022-05-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json index dbe4b0f53a57..8f808801f946 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json @@ -99,4 +99,4 @@ "operation_groups": { "security_connectors": "SecurityConnectorsOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py index 645ad34a5a74..2c12da03e992 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-05-01-preview") # type: str + api_version = kwargs.pop("api_version", "2022-05-01-preview") # type: Literal["2022-05-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py index ba821a2b9604..3f7a149b2b74 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -37,6 +38,10 @@ build_update_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +79,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] error_map = { @@ -100,10 +107,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -153,7 +167,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] error_map = { @@ -180,10 +196,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -241,7 +264,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] request = build_get_request( @@ -372,7 +397,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] @@ -516,7 +543,9 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] @@ -589,7 +618,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py index 367dcbb28009..7328d7eb9110 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/models/_models_py3.py @@ -13,13 +13,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py index 5805cac04db7..dfc75e6d5f8c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,9 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +109,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +146,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -173,7 +186,9 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -211,7 +226,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -273,7 +290,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] error_map = { @@ -299,10 +318,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -350,7 +376,9 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] error_map = { @@ -377,10 +405,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" @@ -436,7 +471,9 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] request = build_get_request( @@ -567,7 +604,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] @@ -711,7 +750,9 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] @@ -784,7 +825,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-05-01-preview") + ) # type: Literal["2022-05-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py index a5eaeae6d251..b4893ccdf609 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/__init__.py @@ -18,7 +18,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py index 4f850ae9dd02..19075a8c40b3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-07-01-preview") # type: str + api_version = kwargs.pop("api_version", "2022-07-01-preview") # type: Literal["2022-07-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json index efa3dfcf5512..934d3a1b93c2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json @@ -102,4 +102,4 @@ "security_connector_applications": "SecurityConnectorApplicationsOperations", "security_connector_application": "SecurityConnectorApplicationOperations" } -} \ No newline at end of file +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py index 17bf2c4a484a..5b78291ec454 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/__init__.py @@ -15,7 +15,9 @@ _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["SecurityCenter"] +__all__ = [ + "SecurityCenter", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py index 0deed982445d..5caa1ff7da9b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-in def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(SecurityCenterConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-07-01-preview") # type: str + api_version = kwargs.pop("api_version", "2022-07-01-preview") # type: Literal["2022-07-01-preview"] if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py index 5316d5c5926f..85dc02912d07 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,6 +32,10 @@ build_get_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,9 @@ async def get(self, application_id: str, **kwargs: Any) -> _models.Application: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] request = build_get_request( @@ -186,7 +193,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] @@ -260,7 +269,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py index 419036d7e72d..007fca2dda37 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._applications_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +70,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Application"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] error_map = { @@ -91,10 +98,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py index 91d9ad9b9b71..9d8b5af8b8ef 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,6 +32,10 @@ build_get_request, ) +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] request = build_get_request( @@ -224,7 +231,9 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] @@ -305,7 +314,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py index 2e53ecc05656..92eaa30a2497 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._security_connector_applications_operations import build_list_request +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +77,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] error_map = { @@ -100,10 +107,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py index 2c6fc4f63791..335ade6e169d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py @@ -12,13 +12,14 @@ from ... import _serialization -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object @@ -130,7 +131,7 @@ class ApplicationCondition(_serialization.Model): :ivar value: The application Condition's Value like IDs that contain some string, see examples. :vartype value: str :ivar operator: The application Condition's Operator, for example Contains for id or In for - list of possible IDs, see examples. Known values are: "Contains" and "In". + list of possible IDs, see examples. Known values are: "Contains", "Equals", and "In". :vartype operator: str or ~azure.mgmt.security.v2022_07_01_preview.models.ApplicationConditionOperator """ @@ -156,7 +157,7 @@ def __init__( examples. :paramtype value: str :keyword operator: The application Condition's Operator, for example Contains for id or In for - list of possible IDs, see examples. Known values are: "Contains" and "In". + list of possible IDs, see examples. Known values are: "Contains", "Equals", and "In". :paramtype operator: str or ~azure.mgmt.security.v2022_07_01_preview.models.ApplicationConditionOperator """ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py index 12aac085f4d9..5b64e0a4d2a4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py @@ -17,6 +17,8 @@ class ApplicationConditionOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta) #: Checks that the string value of the data defined in Property contains the given value CONTAINS = "Contains" + #: Checks that the string value of the data defined in Property equals the given value + EQUALS = "Equals" #: Checks that the string value of the data defined in Property equals any of the given values #: (exact fit) IN = "In" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py index 770083ef312d..e84db16005c4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(application_id: str, subscription_id: str, **kwargs: Any) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +74,9 @@ def build_create_or_update_request(application_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -98,7 +107,9 @@ def build_create_or_update_request(application_id: str, subscription_id: str, ** def build_delete_request(application_id: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" @@ -160,7 +171,9 @@ def get(self, application_id: str, **kwargs: Any) -> _models.Application: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] request = build_get_request( @@ -269,7 +282,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] @@ -341,7 +356,9 @@ def delete(self, application_id: str, **kwargs: Any) -> None: # pylint: disable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py index 7b0535d80620..f8006290b71d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_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 = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +101,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Application"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] error_map = { @@ -120,10 +129,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py index 08e026b1527c..291bb2803f03 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +83,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] accept = _headers.pop("Accept", "application/json") @@ -114,7 +123,9 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] # Construct URL _url = kwargs.pop( "template_url", @@ -188,7 +199,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] request = build_get_request( @@ -328,7 +341,9 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] cls = kwargs.pop("cls", None) # type: ClsType[_models.Application] @@ -409,7 +424,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[None] request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py index ef50603d49e9..858b1ef83b94 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py @@ -6,8 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from ..._serialization import Serializer from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +117,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) # type: str + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-07-01-preview") + ) # type: Literal["2022-07-01-preview"] cls = kwargs.pop("cls", None) # type: ClsType[_models.ApplicationsList] error_map = { @@ -138,10 +147,17 @@ def prepare_request(next_link=None): else: # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py new file mode 100644 index 000000000000..b4893ccdf609 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/__init__.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._security_center import SecurityCenter +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "SecurityCenter", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py new file mode 100644 index 000000000000..f5c6e9e2a86e --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for SecurityCenter. + + 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: Azure subscription ID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(SecurityCenterConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop("api_version", "2022-08-01-preview") # type: Literal["2022-08-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-security/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json new file mode 100644 index 000000000000..e9aceb5f52df --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json @@ -0,0 +1,102 @@ +{ + "chosen_version": "2022-08-01-preview", + "total_api_version_list": ["2022-08-01-preview"], + "client": { + "name": "SecurityCenter", + "filename": "_security_center", + "description": "API spec for Microsoft.Security (Azure Security Center) resource provider.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"azurecore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"azurecore\": {\"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 + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Azure subscription ID. Required.", + "docstring_type": "str", + "required": true + } + }, + "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": "Azure subscription ID. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "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 + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "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\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "security_connectors": "SecurityConnectorsOperations" + } +} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# 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/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py new file mode 100644 index 000000000000..db8abdba93dc --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from .._serialization import Deserializer, Serializer +from ._configuration import SecurityCenterConfiguration +from .operations import SecurityConnectorsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword + """API spec for Microsoft.Security (Azure Security Center) resource provider. + + :ivar security_connectors: SecurityConnectorsOperations operations + :vartype security_connectors: + azure.mgmt.security.v2022_08_01_preview.operations.SecurityConnectorsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Azure subscription ID. 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 "2022-08-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, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.security_connectors = SecurityConnectorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/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, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> SecurityCenter + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py new file mode 100644 index 000000000000..9aad73fc743e --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] + template = "/".join(components) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py new file mode 100644 index 000000000000..5b78291ec454 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._security_center import SecurityCenter + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "SecurityCenter", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..c5692cc3dbe4 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_configuration.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class SecurityCenterConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for SecurityCenter. + + 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: Azure subscription ID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + super(SecurityCenterConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop("api_version", "2022-08-01-preview") # type: Literal["2022-08-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-security/{}".format(VERSION)) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# 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/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py new file mode 100644 index 000000000000..ce5d099e1e9a --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ..._serialization import Deserializer, Serializer +from ._configuration import SecurityCenterConfiguration +from .operations import SecurityConnectorsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword + """API spec for Microsoft.Security (Azure Security Center) resource provider. + + :ivar security_connectors: SecurityConnectorsOperations operations + :vartype security_connectors: + azure.mgmt.security.v2022_08_01_preview.aio.operations.SecurityConnectorsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Azure subscription ID. 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 "2022-08-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, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SecurityCenterConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.security_connectors = SecurityConnectorsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/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, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "SecurityCenter": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..4660a96abf0f --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._security_connectors_operations import SecurityConnectorsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "SecurityConnectorsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# 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/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py new file mode 100644 index 000000000000..342f7cc07e99 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py @@ -0,0 +1,651 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, 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.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._security_connectors_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, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SecurityConnectorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.security.v2022_08_01_preview.aio.SecurityCenter`'s + :attr:`security_connectors` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: + """Lists all the security connectors in the specified subscription. Use the 'nextLink' property in + the response to get the next page of security connectors for the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConnector or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + + error_map = { + 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, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SecurityConnector"]: + """Lists all the security connectors in the specified resource group. Use the 'nextLink' property + in the response to get the next page of security connectors for the specified resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConnector or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, security_connector_name: str, **kwargs: Any + ) -> _models.SecurityConnector: + """Retrieves details of a specific security connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + + request = build_get_request( + resource_group_name=resource_group_name, + security_connector_name=security_connector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityConnector", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: _models.SecurityConnector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityConnector: + """Creates or updates a security connector. If a security connector is already created and a + subsequent request is issued for the same security connector id, then it will be updated. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Required. + :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityConnector: + """Creates or updates a security connector. If a security connector is already created and a + subsequent request is issued for the same security connector id, then it will be updated. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Required. + :type security_connector: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: Union[_models.SecurityConnector, IO], + **kwargs: Any + ) -> _models.SecurityConnector: + """Creates or updates a security connector. If a security connector is already created and a + subsequent request is issued for the same security connector id, then it will be updated. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Is either a model type or a IO + type. Required. + :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_connector, (IO, bytes)): + _content = security_connector + else: + _json = self._serialize.body(security_connector, "SecurityConnector") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + security_connector_name=security_connector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SecurityConnector", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SecurityConnector", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: _models.SecurityConnector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityConnector: + """Updates a security connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Required. + :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityConnector: + """Updates a security connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Required. + :type security_connector: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: Union[_models.SecurityConnector, IO], + **kwargs: Any + ) -> _models.SecurityConnector: + """Updates a security connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Is either a model type or a IO + type. Required. + :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_connector, (IO, bytes)): + _content = security_connector + else: + _json = self._serialize.body(security_connector, "SecurityConnector") + + request = build_update_request( + resource_group_name=resource_group_name, + security_connector_name=security_connector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityConnector", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, security_connector_name: str, **kwargs: Any + ) -> None: + """Deletes a security connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + security_connector_name=security_connector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py new file mode 100644 index 000000000000..3ae38c38dc10 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/__init__.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 AwsEnvironmentData +from ._models_py3 import AwsOrganizationalData +from ._models_py3 import AwsOrganizationalDataMaster +from ._models_py3 import AwsOrganizationalDataMember +from ._models_py3 import AzureDevOpsScopeEnvironmentData +from ._models_py3 import AzureTrackedResourceLocation +from ._models_py3 import CloudErrorBody +from ._models_py3 import CloudOffering +from ._models_py3 import CspmMonitorAwsOffering +from ._models_py3 import CspmMonitorAwsOfferingNativeCloudConnection +from ._models_py3 import CspmMonitorAzureDevOpsOffering +from ._models_py3 import CspmMonitorGcpOffering +from ._models_py3 import CspmMonitorGcpOfferingNativeCloudConnection +from ._models_py3 import CspmMonitorGithubOffering +from ._models_py3 import DefenderCspmAwsOffering +from ._models_py3 import DefenderCspmAwsOfferingVmScanners +from ._models_py3 import DefenderCspmAwsOfferingVmScannersConfiguration +from ._models_py3 import DefenderCspmGcpOffering +from ._models_py3 import DefenderFoDatabasesAwsOffering +from ._models_py3 import DefenderFoDatabasesAwsOfferingArcAutoProvisioning +from ._models_py3 import DefenderFoDatabasesAwsOfferingRds +from ._models_py3 import DefenderForContainersAwsOffering +from ._models_py3 import DefenderForContainersAwsOfferingCloudWatchToKinesis +from ._models_py3 import DefenderForContainersAwsOfferingContainerVulnerabilityAssessment +from ._models_py3 import DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask +from ._models_py3 import DefenderForContainersAwsOfferingKinesisToS3 +from ._models_py3 import DefenderForContainersAwsOfferingKubernetesScubaReader +from ._models_py3 import DefenderForContainersAwsOfferingKubernetesService +from ._models_py3 import DefenderForContainersGcpOffering +from ._models_py3 import DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection +from ._models_py3 import DefenderForContainersGcpOfferingNativeCloudConnection +from ._models_py3 import DefenderForDatabasesGcpOffering +from ._models_py3 import DefenderForDatabasesGcpOfferingArcAutoProvisioning +from ._models_py3 import DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning +from ._models_py3 import DefenderForDevOpsAzureDevOpsOffering +from ._models_py3 import DefenderForDevOpsGithubOffering +from ._models_py3 import DefenderForServersAwsOffering +from ._models_py3 import DefenderForServersAwsOfferingArcAutoProvisioning +from ._models_py3 import DefenderForServersAwsOfferingDefenderForServers +from ._models_py3 import DefenderForServersAwsOfferingMdeAutoProvisioning +from ._models_py3 import DefenderForServersAwsOfferingSubPlan +from ._models_py3 import DefenderForServersAwsOfferingVaAutoProvisioning +from ._models_py3 import DefenderForServersAwsOfferingVaAutoProvisioningConfiguration +from ._models_py3 import DefenderForServersAwsOfferingVmScanners +from ._models_py3 import DefenderForServersAwsOfferingVmScannersConfiguration +from ._models_py3 import DefenderForServersGcpOffering +from ._models_py3 import DefenderForServersGcpOfferingArcAutoProvisioning +from ._models_py3 import DefenderForServersGcpOfferingDefenderForServers +from ._models_py3 import DefenderForServersGcpOfferingMdeAutoProvisioning +from ._models_py3 import DefenderForServersGcpOfferingSubPlan +from ._models_py3 import DefenderForServersGcpOfferingVaAutoProvisioning +from ._models_py3 import DefenderForServersGcpOfferingVaAutoProvisioningConfiguration +from ._models_py3 import ETag +from ._models_py3 import EnvironmentData +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import GcpOrganizationalData +from ._models_py3 import GcpOrganizationalDataMember +from ._models_py3 import GcpOrganizationalDataOrganization +from ._models_py3 import GcpProjectDetails +from ._models_py3 import GcpProjectEnvironmentData +from ._models_py3 import GithubScopeEnvironmentData +from ._models_py3 import InformationProtectionAwsOffering +from ._models_py3 import InformationProtectionAwsOfferingInformationProtection +from ._models_py3 import Kind +from ._models_py3 import Resource +from ._models_py3 import SecurityConnector +from ._models_py3 import SecurityConnectorsList +from ._models_py3 import SystemData +from ._models_py3 import Tags +from ._models_py3 import TrackedResource + +from ._security_center_enums import CloudName +from ._security_center_enums import CreatedByType +from ._security_center_enums import EnvironmentType +from ._security_center_enums import OfferingType +from ._security_center_enums import OrganizationMembershipType +from ._security_center_enums import ScanningMode +from ._security_center_enums import SubPlan +from ._security_center_enums import Type +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "AwsEnvironmentData", + "AwsOrganizationalData", + "AwsOrganizationalDataMaster", + "AwsOrganizationalDataMember", + "AzureDevOpsScopeEnvironmentData", + "AzureTrackedResourceLocation", + "CloudErrorBody", + "CloudOffering", + "CspmMonitorAwsOffering", + "CspmMonitorAwsOfferingNativeCloudConnection", + "CspmMonitorAzureDevOpsOffering", + "CspmMonitorGcpOffering", + "CspmMonitorGcpOfferingNativeCloudConnection", + "CspmMonitorGithubOffering", + "DefenderCspmAwsOffering", + "DefenderCspmAwsOfferingVmScanners", + "DefenderCspmAwsOfferingVmScannersConfiguration", + "DefenderCspmGcpOffering", + "DefenderFoDatabasesAwsOffering", + "DefenderFoDatabasesAwsOfferingArcAutoProvisioning", + "DefenderFoDatabasesAwsOfferingRds", + "DefenderForContainersAwsOffering", + "DefenderForContainersAwsOfferingCloudWatchToKinesis", + "DefenderForContainersAwsOfferingContainerVulnerabilityAssessment", + "DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask", + "DefenderForContainersAwsOfferingKinesisToS3", + "DefenderForContainersAwsOfferingKubernetesScubaReader", + "DefenderForContainersAwsOfferingKubernetesService", + "DefenderForContainersGcpOffering", + "DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection", + "DefenderForContainersGcpOfferingNativeCloudConnection", + "DefenderForDatabasesGcpOffering", + "DefenderForDatabasesGcpOfferingArcAutoProvisioning", + "DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning", + "DefenderForDevOpsAzureDevOpsOffering", + "DefenderForDevOpsGithubOffering", + "DefenderForServersAwsOffering", + "DefenderForServersAwsOfferingArcAutoProvisioning", + "DefenderForServersAwsOfferingDefenderForServers", + "DefenderForServersAwsOfferingMdeAutoProvisioning", + "DefenderForServersAwsOfferingSubPlan", + "DefenderForServersAwsOfferingVaAutoProvisioning", + "DefenderForServersAwsOfferingVaAutoProvisioningConfiguration", + "DefenderForServersAwsOfferingVmScanners", + "DefenderForServersAwsOfferingVmScannersConfiguration", + "DefenderForServersGcpOffering", + "DefenderForServersGcpOfferingArcAutoProvisioning", + "DefenderForServersGcpOfferingDefenderForServers", + "DefenderForServersGcpOfferingMdeAutoProvisioning", + "DefenderForServersGcpOfferingSubPlan", + "DefenderForServersGcpOfferingVaAutoProvisioning", + "DefenderForServersGcpOfferingVaAutoProvisioningConfiguration", + "ETag", + "EnvironmentData", + "ErrorAdditionalInfo", + "GcpOrganizationalData", + "GcpOrganizationalDataMember", + "GcpOrganizationalDataOrganization", + "GcpProjectDetails", + "GcpProjectEnvironmentData", + "GithubScopeEnvironmentData", + "InformationProtectionAwsOffering", + "InformationProtectionAwsOfferingInformationProtection", + "Kind", + "Resource", + "SecurityConnector", + "SecurityConnectorsList", + "SystemData", + "Tags", + "TrackedResource", + "CloudName", + "CreatedByType", + "EnvironmentType", + "OfferingType", + "OrganizationMembershipType", + "ScanningMode", + "SubPlan", + "Type", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..29f7a7f69034 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_models_py3.py @@ -0,0 +1,2767 @@ +# 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 +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class EnvironmentData(_serialization.Model): + """The security connector environment data. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AwsEnvironmentData, AzureDevOpsScopeEnvironmentData, GcpProjectEnvironmentData, + GithubScopeEnvironmentData + + All required parameters must be populated in order to send to Azure. + + :ivar environment_type: The type of the environment data. Required. Known values are: + "AwsAccount", "GcpProject", "GithubScope", and "AzureDevOpsScope". + :vartype environment_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.EnvironmentType + """ + + _validation = { + "environment_type": {"required": True}, + } + + _attribute_map = { + "environment_type": {"key": "environmentType", "type": "str"}, + } + + _subtype_map = { + "environment_type": { + "AwsAccount": "AwsEnvironmentData", + "AzureDevOpsScope": "AzureDevOpsScopeEnvironmentData", + "GcpProject": "GcpProjectEnvironmentData", + "GithubScope": "GithubScopeEnvironmentData", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.environment_type = None # type: Optional[str] + + +class AwsEnvironmentData(EnvironmentData): + """The aws connector environment data. + + All required parameters must be populated in order to send to Azure. + + :ivar environment_type: The type of the environment data. Required. Known values are: + "AwsAccount", "GcpProject", "GithubScope", and "AzureDevOpsScope". + :vartype environment_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.EnvironmentType + :ivar organizational_data: The AWS account's organizational data. + :vartype organizational_data: + ~azure.mgmt.security.v2022_08_01_preview.models.AwsOrganizationalData + """ + + _validation = { + "environment_type": {"required": True}, + } + + _attribute_map = { + "environment_type": {"key": "environmentType", "type": "str"}, + "organizational_data": {"key": "organizationalData", "type": "AwsOrganizationalData"}, + } + + def __init__(self, *, organizational_data: Optional["_models.AwsOrganizationalData"] = None, **kwargs): + """ + :keyword organizational_data: The AWS account's organizational data. + :paramtype organizational_data: + ~azure.mgmt.security.v2022_08_01_preview.models.AwsOrganizationalData + """ + super().__init__(**kwargs) + self.environment_type = "AwsAccount" # type: str + self.organizational_data = organizational_data + + +class AwsOrganizationalData(_serialization.Model): + """The awsOrganization data. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AwsOrganizationalDataMember, AwsOrganizationalDataMaster + + All required parameters must be populated in order to send to Azure. + + :ivar organization_membership_type: The multi cloud account's membership type in the + organization. Required. Known values are: "Member" and "Organization". + :vartype organization_membership_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.OrganizationMembershipType + """ + + _validation = { + "organization_membership_type": {"required": True}, + } + + _attribute_map = { + "organization_membership_type": {"key": "organizationMembershipType", "type": "str"}, + } + + _subtype_map = { + "organization_membership_type": { + "Member": "AwsOrganizationalDataMember", + "Organization": "AwsOrganizationalDataMaster", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.organization_membership_type = None # type: Optional[str] + + +class AwsOrganizationalDataMaster(AwsOrganizationalData): + """The awsOrganization data for the master account. + + All required parameters must be populated in order to send to Azure. + + :ivar organization_membership_type: The multi cloud account's membership type in the + organization. Required. Known values are: "Member" and "Organization". + :vartype organization_membership_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.OrganizationMembershipType + :ivar stackset_name: If the multi cloud account is of membership type organization, this will + be the name of the onboarding stackset. + :vartype stackset_name: str + :ivar excluded_account_ids: If the multi cloud account is of membership type organization, list + of accounts excluded from offering. + :vartype excluded_account_ids: list[str] + """ + + _validation = { + "organization_membership_type": {"required": True}, + } + + _attribute_map = { + "organization_membership_type": {"key": "organizationMembershipType", "type": "str"}, + "stackset_name": {"key": "stacksetName", "type": "str"}, + "excluded_account_ids": {"key": "excludedAccountIds", "type": "[str]"}, + } + + def __init__( + self, *, stackset_name: Optional[str] = None, excluded_account_ids: Optional[List[str]] = None, **kwargs + ): + """ + :keyword stackset_name: If the multi cloud account is of membership type organization, this + will be the name of the onboarding stackset. + :paramtype stackset_name: str + :keyword excluded_account_ids: If the multi cloud account is of membership type organization, + list of accounts excluded from offering. + :paramtype excluded_account_ids: list[str] + """ + super().__init__(**kwargs) + self.organization_membership_type = "Organization" # type: str + self.stackset_name = stackset_name + self.excluded_account_ids = excluded_account_ids + + +class AwsOrganizationalDataMember(AwsOrganizationalData): + """The awsOrganization data for the member account. + + All required parameters must be populated in order to send to Azure. + + :ivar organization_membership_type: The multi cloud account's membership type in the + organization. Required. Known values are: "Member" and "Organization". + :vartype organization_membership_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.OrganizationMembershipType + :ivar parent_hierarchy_id: If the multi cloud account is not of membership type organization, + this will be the ID of the account's parent. + :vartype parent_hierarchy_id: str + """ + + _validation = { + "organization_membership_type": {"required": True}, + } + + _attribute_map = { + "organization_membership_type": {"key": "organizationMembershipType", "type": "str"}, + "parent_hierarchy_id": {"key": "parentHierarchyId", "type": "str"}, + } + + def __init__(self, *, parent_hierarchy_id: Optional[str] = None, **kwargs): + """ + :keyword parent_hierarchy_id: If the multi cloud account is not of membership type + organization, this will be the ID of the account's parent. + :paramtype parent_hierarchy_id: str + """ + super().__init__(**kwargs) + self.organization_membership_type = "Member" # type: str + self.parent_hierarchy_id = parent_hierarchy_id + + +class AzureDevOpsScopeEnvironmentData(EnvironmentData): + """The AzureDevOps scope connector's environment data. + + All required parameters must be populated in order to send to Azure. + + :ivar environment_type: The type of the environment data. Required. Known values are: + "AwsAccount", "GcpProject", "GithubScope", and "AzureDevOpsScope". + :vartype environment_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.EnvironmentType + """ + + _validation = { + "environment_type": {"required": True}, + } + + _attribute_map = { + "environment_type": {"key": "environmentType", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.environment_type = "AzureDevOpsScope" # type: str + + +class AzureTrackedResourceLocation(_serialization.Model): + """Describes an Azure resource with location. + + :ivar location: Location where the resource is stored. + :vartype location: str + """ + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: Optional[str] = None, **kwargs): + """ + :keyword location: Location where the resource is stored. + :paramtype location: str + """ + super().__init__(**kwargs) + self.location = location + + +class CloudErrorBody(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.security.v2022_08_01_preview.models.CloudErrorBody] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.security.v2022_08_01_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class CloudOffering(_serialization.Model): + """The security offering details. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CspmMonitorAwsOffering, CspmMonitorAzureDevOpsOffering, CspmMonitorGcpOffering, + CspmMonitorGithubOffering, DefenderCspmAwsOffering, DefenderCspmGcpOffering, + DefenderForContainersAwsOffering, DefenderForContainersGcpOffering, + DefenderFoDatabasesAwsOffering, DefenderForDatabasesGcpOffering, + DefenderForDevOpsAzureDevOpsOffering, DefenderForDevOpsGithubOffering, + DefenderForServersAwsOffering, DefenderForServersGcpOffering, InformationProtectionAwsOffering + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + _subtype_map = { + "offering_type": { + "CspmMonitorAws": "CspmMonitorAwsOffering", + "CspmMonitorAzureDevOps": "CspmMonitorAzureDevOpsOffering", + "CspmMonitorGcp": "CspmMonitorGcpOffering", + "CspmMonitorGithub": "CspmMonitorGithubOffering", + "DefenderCspmAws": "DefenderCspmAwsOffering", + "DefenderCspmGcp": "DefenderCspmGcpOffering", + "DefenderForContainersAws": "DefenderForContainersAwsOffering", + "DefenderForContainersGcp": "DefenderForContainersGcpOffering", + "DefenderForDatabasesAws": "DefenderFoDatabasesAwsOffering", + "DefenderForDatabasesGcp": "DefenderForDatabasesGcpOffering", + "DefenderForDevOpsAzureDevOps": "DefenderForDevOpsAzureDevOpsOffering", + "DefenderForDevOpsGithub": "DefenderForDevOpsGithubOffering", + "DefenderForServersAws": "DefenderForServersAwsOffering", + "DefenderForServersGcp": "DefenderForServersGcpOffering", + "InformationProtectionAws": "InformationProtectionAwsOffering", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.offering_type = None # type: Optional[str] + self.description = None + + +class CspmMonitorAwsOffering(CloudOffering): + """The CSPM monitoring for AWS offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + :ivar native_cloud_connection: The native cloud connection configuration. + :vartype native_cloud_connection: + ~azure.mgmt.security.v2022_08_01_preview.models.CspmMonitorAwsOfferingNativeCloudConnection + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "native_cloud_connection": { + "key": "nativeCloudConnection", + "type": "CspmMonitorAwsOfferingNativeCloudConnection", + }, + } + + def __init__( + self, + *, + native_cloud_connection: Optional["_models.CspmMonitorAwsOfferingNativeCloudConnection"] = None, + **kwargs + ): + """ + :keyword native_cloud_connection: The native cloud connection configuration. + :paramtype native_cloud_connection: + ~azure.mgmt.security.v2022_08_01_preview.models.CspmMonitorAwsOfferingNativeCloudConnection + """ + super().__init__(**kwargs) + self.offering_type = "CspmMonitorAws" # type: str + self.native_cloud_connection = native_cloud_connection + + +class CspmMonitorAwsOfferingNativeCloudConnection(_serialization.Model): + """The native cloud connection configuration. + + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + + +class CspmMonitorAzureDevOpsOffering(CloudOffering): + """The CSPM monitoring for AzureDevOps offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.offering_type = "CspmMonitorAzureDevOps" # type: str + + +class CspmMonitorGcpOffering(CloudOffering): + """The CSPM monitoring for GCP offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + :ivar native_cloud_connection: The native cloud connection configuration. + :vartype native_cloud_connection: + ~azure.mgmt.security.v2022_08_01_preview.models.CspmMonitorGcpOfferingNativeCloudConnection + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "native_cloud_connection": { + "key": "nativeCloudConnection", + "type": "CspmMonitorGcpOfferingNativeCloudConnection", + }, + } + + def __init__( + self, + *, + native_cloud_connection: Optional["_models.CspmMonitorGcpOfferingNativeCloudConnection"] = None, + **kwargs + ): + """ + :keyword native_cloud_connection: The native cloud connection configuration. + :paramtype native_cloud_connection: + ~azure.mgmt.security.v2022_08_01_preview.models.CspmMonitorGcpOfferingNativeCloudConnection + """ + super().__init__(**kwargs) + self.offering_type = "CspmMonitorGcp" # type: str + self.native_cloud_connection = native_cloud_connection + + +class CspmMonitorGcpOfferingNativeCloudConnection(_serialization.Model): + """The native cloud connection configuration. + + :ivar workload_identity_provider_id: The GCP workload identity provider id for the offering. + :vartype workload_identity_provider_id: str + :ivar service_account_email_address: The service account email address in GCP for this + offering. + :vartype service_account_email_address: str + """ + + _attribute_map = { + "workload_identity_provider_id": {"key": "workloadIdentityProviderId", "type": "str"}, + "service_account_email_address": {"key": "serviceAccountEmailAddress", "type": "str"}, + } + + def __init__( + self, + *, + workload_identity_provider_id: Optional[str] = None, + service_account_email_address: Optional[str] = None, + **kwargs + ): + """ + :keyword workload_identity_provider_id: The GCP workload identity provider id for the offering. + :paramtype workload_identity_provider_id: str + :keyword service_account_email_address: The service account email address in GCP for this + offering. + :paramtype service_account_email_address: str + """ + super().__init__(**kwargs) + self.workload_identity_provider_id = workload_identity_provider_id + self.service_account_email_address = service_account_email_address + + +class CspmMonitorGithubOffering(CloudOffering): + """The CSPM monitoring for github offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.offering_type = "CspmMonitorGithub" # type: str + + +class DefenderCspmAwsOffering(CloudOffering): + """The CSPM P1 for Aws offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + :ivar vm_scanners: The Microsoft Defender for Server VM scanning configuration. + :vartype vm_scanners: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderCspmAwsOfferingVmScanners + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "vm_scanners": {"key": "vmScanners", "type": "DefenderCspmAwsOfferingVmScanners"}, + } + + def __init__(self, *, vm_scanners: Optional["_models.DefenderCspmAwsOfferingVmScanners"] = None, **kwargs): + """ + :keyword vm_scanners: The Microsoft Defender for Server VM scanning configuration. + :paramtype vm_scanners: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderCspmAwsOfferingVmScanners + """ + super().__init__(**kwargs) + self.offering_type = "DefenderCspmAws" # type: str + self.vm_scanners = vm_scanners + + +class DefenderCspmAwsOfferingVmScanners(_serialization.Model): + """The Microsoft Defender for Server VM scanning configuration. + + :ivar enabled: Is Microsoft Defender for Server VM scanning enabled. + :vartype enabled: bool + :ivar configuration: configuration for Microsoft Defender for Server VM scanning. + :vartype configuration: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderCspmAwsOfferingVmScannersConfiguration + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "configuration": {"key": "configuration", "type": "DefenderCspmAwsOfferingVmScannersConfiguration"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + configuration: Optional["_models.DefenderCspmAwsOfferingVmScannersConfiguration"] = None, + **kwargs + ): + """ + :keyword enabled: Is Microsoft Defender for Server VM scanning enabled. + :paramtype enabled: bool + :keyword configuration: configuration for Microsoft Defender for Server VM scanning. + :paramtype configuration: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderCspmAwsOfferingVmScannersConfiguration + """ + super().__init__(**kwargs) + self.enabled = enabled + self.configuration = configuration + + +class DefenderCspmAwsOfferingVmScannersConfiguration(_serialization.Model): + """configuration for Microsoft Defender for Server VM scanning. + + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature. + :vartype cloud_role_arn: str + :ivar scanning_mode: The scanning mode for the vm scan. "Default" + :vartype scanning_mode: str or ~azure.mgmt.security.v2022_08_01_preview.models.ScanningMode + :ivar exclusion_tags: VM tags that indicates that VM should not be scanned. + :vartype exclusion_tags: dict[str, str] + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + "scanning_mode": {"key": "scanningMode", "type": "str"}, + "exclusion_tags": {"key": "exclusionTags", "type": "{str}"}, + } + + def __init__( + self, + *, + cloud_role_arn: Optional[str] = None, + scanning_mode: Optional[Union[str, "_models.ScanningMode"]] = None, + exclusion_tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. + :paramtype cloud_role_arn: str + :keyword scanning_mode: The scanning mode for the vm scan. "Default" + :paramtype scanning_mode: str or ~azure.mgmt.security.v2022_08_01_preview.models.ScanningMode + :keyword exclusion_tags: VM tags that indicates that VM should not be scanned. + :paramtype exclusion_tags: dict[str, str] + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + self.scanning_mode = scanning_mode + self.exclusion_tags = exclusion_tags + + +class DefenderCspmGcpOffering(CloudOffering): + """The CSPM P1 for GCP offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.offering_type = "DefenderCspmGcp" # type: str + + +class DefenderFoDatabasesAwsOffering(CloudOffering): + """The Defender for Databases AWS offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + :ivar arc_auto_provisioning: The ARC autoprovisioning configuration. + :vartype arc_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning + :ivar rds: The RDS configuration. + :vartype rds: ~azure.mgmt.security.v2022_08_01_preview.models.DefenderFoDatabasesAwsOfferingRds + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "arc_auto_provisioning": { + "key": "arcAutoProvisioning", + "type": "DefenderFoDatabasesAwsOfferingArcAutoProvisioning", + }, + "rds": {"key": "rds", "type": "DefenderFoDatabasesAwsOfferingRds"}, + } + + def __init__( + self, + *, + arc_auto_provisioning: Optional["_models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning"] = None, + rds: Optional["_models.DefenderFoDatabasesAwsOfferingRds"] = None, + **kwargs + ): + """ + :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. + :paramtype arc_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderFoDatabasesAwsOfferingArcAutoProvisioning + :keyword rds: The RDS configuration. + :paramtype rds: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderFoDatabasesAwsOfferingRds + """ + super().__init__(**kwargs) + self.offering_type = "DefenderForDatabasesAws" # type: str + self.arc_auto_provisioning = arc_auto_provisioning + self.rds = rds + + +class DefenderFoDatabasesAwsOfferingArcAutoProvisioning(_serialization.Model): + """The ARC autoprovisioning configuration. + + :ivar enabled: Is arc auto provisioning enabled. + :vartype enabled: bool + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword enabled: Is arc auto provisioning enabled. + :paramtype enabled: bool + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.cloud_role_arn = cloud_role_arn + + +class DefenderFoDatabasesAwsOfferingRds(_serialization.Model): + """The RDS configuration. + + :ivar enabled: Is RDS protection enabled. + :vartype enabled: bool + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword enabled: Is RDS protection enabled. + :paramtype enabled: bool + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.cloud_role_arn = cloud_role_arn + + +class DefenderForContainersAwsOffering(CloudOffering): # pylint: disable=too-many-instance-attributes + """The Defender for Containers AWS offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + :ivar kubernetes_service: The kubernetes service connection configuration. + :vartype kubernetes_service: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingKubernetesService + :ivar kubernetes_scuba_reader: The kubernetes to scuba connection configuration. + :vartype kubernetes_scuba_reader: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingKubernetesScubaReader + :ivar cloud_watch_to_kinesis: The cloudwatch to kinesis connection configuration. + :vartype cloud_watch_to_kinesis: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingCloudWatchToKinesis + :ivar kinesis_to_s3: The kinesis to s3 connection configuration. + :vartype kinesis_to_s3: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingKinesisToS3 + :ivar container_vulnerability_assessment: The container vulnerability assessment configuration. + :vartype container_vulnerability_assessment: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessment + :ivar container_vulnerability_assessment_task: The container vulnerability assessment task + configuration. + :vartype container_vulnerability_assessment_task: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask + :ivar enable_container_vulnerability_assessment: Enable container vulnerability assessment + feature. + :vartype enable_container_vulnerability_assessment: bool + :ivar auto_provisioning: Is audit logs pipeline auto provisioning enabled. + :vartype auto_provisioning: bool + :ivar kube_audit_retention_time: The retention time in days of kube audit logs set on the + CloudWatch log group. + :vartype kube_audit_retention_time: int + :ivar scuba_external_id: The externalId used by the data reader to prevent the confused deputy + attack. + :vartype scuba_external_id: str + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "kubernetes_service": {"key": "kubernetesService", "type": "DefenderForContainersAwsOfferingKubernetesService"}, + "kubernetes_scuba_reader": { + "key": "kubernetesScubaReader", + "type": "DefenderForContainersAwsOfferingKubernetesScubaReader", + }, + "cloud_watch_to_kinesis": { + "key": "cloudWatchToKinesis", + "type": "DefenderForContainersAwsOfferingCloudWatchToKinesis", + }, + "kinesis_to_s3": {"key": "kinesisToS3", "type": "DefenderForContainersAwsOfferingKinesisToS3"}, + "container_vulnerability_assessment": { + "key": "containerVulnerabilityAssessment", + "type": "DefenderForContainersAwsOfferingContainerVulnerabilityAssessment", + }, + "container_vulnerability_assessment_task": { + "key": "containerVulnerabilityAssessmentTask", + "type": "DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask", + }, + "enable_container_vulnerability_assessment": {"key": "enableContainerVulnerabilityAssessment", "type": "bool"}, + "auto_provisioning": {"key": "autoProvisioning", "type": "bool"}, + "kube_audit_retention_time": {"key": "kubeAuditRetentionTime", "type": "int"}, + "scuba_external_id": {"key": "scubaExternalId", "type": "str"}, + } + + def __init__( + self, + *, + kubernetes_service: Optional["_models.DefenderForContainersAwsOfferingKubernetesService"] = None, + kubernetes_scuba_reader: Optional["_models.DefenderForContainersAwsOfferingKubernetesScubaReader"] = None, + cloud_watch_to_kinesis: Optional["_models.DefenderForContainersAwsOfferingCloudWatchToKinesis"] = None, + kinesis_to_s3: Optional["_models.DefenderForContainersAwsOfferingKinesisToS3"] = None, + container_vulnerability_assessment: Optional[ + "_models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessment" + ] = None, + container_vulnerability_assessment_task: Optional[ + "_models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask" + ] = None, + enable_container_vulnerability_assessment: Optional[bool] = None, + auto_provisioning: Optional[bool] = None, + kube_audit_retention_time: Optional[int] = None, + scuba_external_id: Optional[str] = None, + **kwargs + ): + """ + :keyword kubernetes_service: The kubernetes service connection configuration. + :paramtype kubernetes_service: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingKubernetesService + :keyword kubernetes_scuba_reader: The kubernetes to scuba connection configuration. + :paramtype kubernetes_scuba_reader: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingKubernetesScubaReader + :keyword cloud_watch_to_kinesis: The cloudwatch to kinesis connection configuration. + :paramtype cloud_watch_to_kinesis: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingCloudWatchToKinesis + :keyword kinesis_to_s3: The kinesis to s3 connection configuration. + :paramtype kinesis_to_s3: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingKinesisToS3 + :keyword container_vulnerability_assessment: The container vulnerability assessment + configuration. + :paramtype container_vulnerability_assessment: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessment + :keyword container_vulnerability_assessment_task: The container vulnerability assessment task + configuration. + :paramtype container_vulnerability_assessment_task: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask + :keyword enable_container_vulnerability_assessment: Enable container vulnerability assessment + feature. + :paramtype enable_container_vulnerability_assessment: bool + :keyword auto_provisioning: Is audit logs pipeline auto provisioning enabled. + :paramtype auto_provisioning: bool + :keyword kube_audit_retention_time: The retention time in days of kube audit logs set on the + CloudWatch log group. + :paramtype kube_audit_retention_time: int + :keyword scuba_external_id: The externalId used by the data reader to prevent the confused + deputy attack. + :paramtype scuba_external_id: str + """ + super().__init__(**kwargs) + self.offering_type = "DefenderForContainersAws" # type: str + self.kubernetes_service = kubernetes_service + self.kubernetes_scuba_reader = kubernetes_scuba_reader + self.cloud_watch_to_kinesis = cloud_watch_to_kinesis + self.kinesis_to_s3 = kinesis_to_s3 + self.container_vulnerability_assessment = container_vulnerability_assessment + self.container_vulnerability_assessment_task = container_vulnerability_assessment_task + self.enable_container_vulnerability_assessment = enable_container_vulnerability_assessment + self.auto_provisioning = auto_provisioning + self.kube_audit_retention_time = kube_audit_retention_time + self.scuba_external_id = scuba_external_id + + +class DefenderForContainersAwsOfferingCloudWatchToKinesis(_serialization.Model): + """The cloudwatch to kinesis connection configuration. + + :ivar cloud_role_arn: The cloud role ARN in AWS used by CloudWatch to transfer data into + Kinesis. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS used by CloudWatch to transfer data into + Kinesis. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + + +class DefenderForContainersAwsOfferingContainerVulnerabilityAssessment(_serialization.Model): + """The container vulnerability assessment configuration. + + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + + +class DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask(_serialization.Model): + """The container vulnerability assessment task configuration. + + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + + +class DefenderForContainersAwsOfferingKinesisToS3(_serialization.Model): + """The kinesis to s3 connection configuration. + + :ivar cloud_role_arn: The cloud role ARN in AWS used by Kinesis to transfer data into S3. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS used by Kinesis to transfer data into S3. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + + +class DefenderForContainersAwsOfferingKubernetesScubaReader(_serialization.Model): + """The kubernetes to scuba connection configuration. + + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature used for reading data. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature used for reading data. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + + +class DefenderForContainersAwsOfferingKubernetesService(_serialization.Model): + """The kubernetes service connection configuration. + + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature used for provisioning + resources. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature used for provisioning + resources. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + + +class DefenderForContainersGcpOffering(CloudOffering): + """The containers GCP offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + :ivar native_cloud_connection: The native cloud connection configuration. + :vartype native_cloud_connection: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersGcpOfferingNativeCloudConnection + :ivar data_pipeline_native_cloud_connection: The native cloud connection configuration. + :vartype data_pipeline_native_cloud_connection: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + :ivar audit_logs_auto_provisioning_flag: Is audit logs data collection enabled. + :vartype audit_logs_auto_provisioning_flag: bool + :ivar defender_agent_auto_provisioning_flag: Is Microsoft Defender for Cloud Kubernetes agent + auto provisioning enabled. + :vartype defender_agent_auto_provisioning_flag: bool + :ivar policy_agent_auto_provisioning_flag: Is Policy Kubernetes agent auto provisioning + enabled. + :vartype policy_agent_auto_provisioning_flag: bool + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "native_cloud_connection": { + "key": "nativeCloudConnection", + "type": "DefenderForContainersGcpOfferingNativeCloudConnection", + }, + "data_pipeline_native_cloud_connection": { + "key": "dataPipelineNativeCloudConnection", + "type": "DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection", + }, + "audit_logs_auto_provisioning_flag": {"key": "auditLogsAutoProvisioningFlag", "type": "bool"}, + "defender_agent_auto_provisioning_flag": {"key": "defenderAgentAutoProvisioningFlag", "type": "bool"}, + "policy_agent_auto_provisioning_flag": {"key": "policyAgentAutoProvisioningFlag", "type": "bool"}, + } + + def __init__( + self, + *, + native_cloud_connection: Optional["_models.DefenderForContainersGcpOfferingNativeCloudConnection"] = None, + data_pipeline_native_cloud_connection: Optional[ + "_models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection" + ] = None, + audit_logs_auto_provisioning_flag: Optional[bool] = None, + defender_agent_auto_provisioning_flag: Optional[bool] = None, + policy_agent_auto_provisioning_flag: Optional[bool] = None, + **kwargs + ): + """ + :keyword native_cloud_connection: The native cloud connection configuration. + :paramtype native_cloud_connection: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersGcpOfferingNativeCloudConnection + :keyword data_pipeline_native_cloud_connection: The native cloud connection configuration. + :paramtype data_pipeline_native_cloud_connection: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection + :keyword audit_logs_auto_provisioning_flag: Is audit logs data collection enabled. + :paramtype audit_logs_auto_provisioning_flag: bool + :keyword defender_agent_auto_provisioning_flag: Is Microsoft Defender for Cloud Kubernetes + agent auto provisioning enabled. + :paramtype defender_agent_auto_provisioning_flag: bool + :keyword policy_agent_auto_provisioning_flag: Is Policy Kubernetes agent auto provisioning + enabled. + :paramtype policy_agent_auto_provisioning_flag: bool + """ + super().__init__(**kwargs) + self.offering_type = "DefenderForContainersGcp" # type: str + self.native_cloud_connection = native_cloud_connection + self.data_pipeline_native_cloud_connection = data_pipeline_native_cloud_connection + self.audit_logs_auto_provisioning_flag = audit_logs_auto_provisioning_flag + self.defender_agent_auto_provisioning_flag = defender_agent_auto_provisioning_flag + self.policy_agent_auto_provisioning_flag = policy_agent_auto_provisioning_flag + + +class DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection(_serialization.Model): + """The native cloud connection configuration. + + :ivar service_account_email_address: The data collection service account email address in GCP + for this offering. + :vartype service_account_email_address: str + :ivar workload_identity_provider_id: The data collection GCP workload identity provider id for + this offering. + :vartype workload_identity_provider_id: str + """ + + _attribute_map = { + "service_account_email_address": {"key": "serviceAccountEmailAddress", "type": "str"}, + "workload_identity_provider_id": {"key": "workloadIdentityProviderId", "type": "str"}, + } + + def __init__( + self, + *, + service_account_email_address: Optional[str] = None, + workload_identity_provider_id: Optional[str] = None, + **kwargs + ): + """ + :keyword service_account_email_address: The data collection service account email address in + GCP for this offering. + :paramtype service_account_email_address: str + :keyword workload_identity_provider_id: The data collection GCP workload identity provider id + for this offering. + :paramtype workload_identity_provider_id: str + """ + super().__init__(**kwargs) + self.service_account_email_address = service_account_email_address + self.workload_identity_provider_id = workload_identity_provider_id + + +class DefenderForContainersGcpOfferingNativeCloudConnection(_serialization.Model): + """The native cloud connection configuration. + + :ivar service_account_email_address: The service account email address in GCP for this + offering. + :vartype service_account_email_address: str + :ivar workload_identity_provider_id: The GCP workload identity provider id for this offering. + :vartype workload_identity_provider_id: str + """ + + _attribute_map = { + "service_account_email_address": {"key": "serviceAccountEmailAddress", "type": "str"}, + "workload_identity_provider_id": {"key": "workloadIdentityProviderId", "type": "str"}, + } + + def __init__( + self, + *, + service_account_email_address: Optional[str] = None, + workload_identity_provider_id: Optional[str] = None, + **kwargs + ): + """ + :keyword service_account_email_address: The service account email address in GCP for this + offering. + :paramtype service_account_email_address: str + :keyword workload_identity_provider_id: The GCP workload identity provider id for this + offering. + :paramtype workload_identity_provider_id: str + """ + super().__init__(**kwargs) + self.service_account_email_address = service_account_email_address + self.workload_identity_provider_id = workload_identity_provider_id + + +class DefenderForDatabasesGcpOffering(CloudOffering): + """The Defender for Databases GCP offering configurations. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + :ivar arc_auto_provisioning: The ARC autoprovisioning configuration. + :vartype arc_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForDatabasesGcpOfferingArcAutoProvisioning + :ivar defender_for_databases_arc_auto_provisioning: The native cloud connection configuration. + :vartype defender_for_databases_arc_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "arc_auto_provisioning": { + "key": "arcAutoProvisioning", + "type": "DefenderForDatabasesGcpOfferingArcAutoProvisioning", + }, + "defender_for_databases_arc_auto_provisioning": { + "key": "defenderForDatabasesArcAutoProvisioning", + "type": "DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning", + }, + } + + def __init__( + self, + *, + arc_auto_provisioning: Optional["_models.DefenderForDatabasesGcpOfferingArcAutoProvisioning"] = None, + defender_for_databases_arc_auto_provisioning: Optional[ + "_models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning" + ] = None, + **kwargs + ): + """ + :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. + :paramtype arc_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForDatabasesGcpOfferingArcAutoProvisioning + :keyword defender_for_databases_arc_auto_provisioning: The native cloud connection + configuration. + :paramtype defender_for_databases_arc_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning + """ + super().__init__(**kwargs) + self.offering_type = "DefenderForDatabasesGcp" # type: str + self.arc_auto_provisioning = arc_auto_provisioning + self.defender_for_databases_arc_auto_provisioning = defender_for_databases_arc_auto_provisioning + + +class DefenderForDatabasesGcpOfferingArcAutoProvisioning(_serialization.Model): + """The ARC autoprovisioning configuration. + + :ivar enabled: Is arc auto provisioning enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + """ + :keyword enabled: Is arc auto provisioning enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning(_serialization.Model): + """The native cloud connection configuration. + + :ivar service_account_email_address: The service account email address in GCP for this + offering. + :vartype service_account_email_address: str + :ivar workload_identity_provider_id: The GCP workload identity provider id for this offering. + :vartype workload_identity_provider_id: str + """ + + _attribute_map = { + "service_account_email_address": {"key": "serviceAccountEmailAddress", "type": "str"}, + "workload_identity_provider_id": {"key": "workloadIdentityProviderId", "type": "str"}, + } + + def __init__( + self, + *, + service_account_email_address: Optional[str] = None, + workload_identity_provider_id: Optional[str] = None, + **kwargs + ): + """ + :keyword service_account_email_address: The service account email address in GCP for this + offering. + :paramtype service_account_email_address: str + :keyword workload_identity_provider_id: The GCP workload identity provider id for this + offering. + :paramtype workload_identity_provider_id: str + """ + super().__init__(**kwargs) + self.service_account_email_address = service_account_email_address + self.workload_identity_provider_id = workload_identity_provider_id + + +class DefenderForDevOpsAzureDevOpsOffering(CloudOffering): + """The Defender for DevOps for Azure DevOps offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.offering_type = "DefenderForDevOpsAzureDevOps" # type: str + + +class DefenderForDevOpsGithubOffering(CloudOffering): + """The Defender for DevOps for Github offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.offering_type = "DefenderForDevOpsGithub" # type: str + + +class DefenderForServersAwsOffering(CloudOffering): + """The Defender for Servers AWS offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + :ivar defender_for_servers: The Defender for servers connection configuration. + :vartype defender_for_servers: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingDefenderForServers + :ivar arc_auto_provisioning: The ARC autoprovisioning configuration. + :vartype arc_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingArcAutoProvisioning + :ivar va_auto_provisioning: The Vulnerability Assessment autoprovisioning configuration. + :vartype va_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingVaAutoProvisioning + :ivar mde_auto_provisioning: The Microsoft Defender for Endpoint autoprovisioning + configuration. + :vartype mde_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingMdeAutoProvisioning + :ivar sub_plan: configuration for the servers offering subPlan. + :vartype sub_plan: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingSubPlan + :ivar vm_scanners: The Microsoft Defender for Server VM scanning configuration. + :vartype vm_scanners: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingVmScanners + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "defender_for_servers": { + "key": "defenderForServers", + "type": "DefenderForServersAwsOfferingDefenderForServers", + }, + "arc_auto_provisioning": { + "key": "arcAutoProvisioning", + "type": "DefenderForServersAwsOfferingArcAutoProvisioning", + }, + "va_auto_provisioning": { + "key": "vaAutoProvisioning", + "type": "DefenderForServersAwsOfferingVaAutoProvisioning", + }, + "mde_auto_provisioning": { + "key": "mdeAutoProvisioning", + "type": "DefenderForServersAwsOfferingMdeAutoProvisioning", + }, + "sub_plan": {"key": "subPlan", "type": "DefenderForServersAwsOfferingSubPlan"}, + "vm_scanners": {"key": "vmScanners", "type": "DefenderForServersAwsOfferingVmScanners"}, + } + + def __init__( + self, + *, + defender_for_servers: Optional["_models.DefenderForServersAwsOfferingDefenderForServers"] = None, + arc_auto_provisioning: Optional["_models.DefenderForServersAwsOfferingArcAutoProvisioning"] = None, + va_auto_provisioning: Optional["_models.DefenderForServersAwsOfferingVaAutoProvisioning"] = None, + mde_auto_provisioning: Optional["_models.DefenderForServersAwsOfferingMdeAutoProvisioning"] = None, + sub_plan: Optional["_models.DefenderForServersAwsOfferingSubPlan"] = None, + vm_scanners: Optional["_models.DefenderForServersAwsOfferingVmScanners"] = None, + **kwargs + ): + """ + :keyword defender_for_servers: The Defender for servers connection configuration. + :paramtype defender_for_servers: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingDefenderForServers + :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. + :paramtype arc_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingArcAutoProvisioning + :keyword va_auto_provisioning: The Vulnerability Assessment autoprovisioning configuration. + :paramtype va_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingVaAutoProvisioning + :keyword mde_auto_provisioning: The Microsoft Defender for Endpoint autoprovisioning + configuration. + :paramtype mde_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingMdeAutoProvisioning + :keyword sub_plan: configuration for the servers offering subPlan. + :paramtype sub_plan: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingSubPlan + :keyword vm_scanners: The Microsoft Defender for Server VM scanning configuration. + :paramtype vm_scanners: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingVmScanners + """ + super().__init__(**kwargs) + self.offering_type = "DefenderForServersAws" # type: str + self.defender_for_servers = defender_for_servers + self.arc_auto_provisioning = arc_auto_provisioning + self.va_auto_provisioning = va_auto_provisioning + self.mde_auto_provisioning = mde_auto_provisioning + self.sub_plan = sub_plan + self.vm_scanners = vm_scanners + + +class DefenderForServersAwsOfferingArcAutoProvisioning(_serialization.Model): + """The ARC autoprovisioning configuration. + + :ivar enabled: Is arc auto provisioning enabled. + :vartype enabled: bool + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword enabled: Is arc auto provisioning enabled. + :paramtype enabled: bool + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.cloud_role_arn = cloud_role_arn + + +class DefenderForServersAwsOfferingDefenderForServers(_serialization.Model): + """The Defender for servers connection configuration. + + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + + +class DefenderForServersAwsOfferingMdeAutoProvisioning(_serialization.Model): + """The Microsoft Defender for Endpoint autoprovisioning configuration. + + :ivar enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. + :vartype enabled: bool + :ivar configuration: configuration for Microsoft Defender for Endpoint autoprovisioning. + :vartype configuration: JSON + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "configuration": {"key": "configuration", "type": "object"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs): + """ + :keyword enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. + :paramtype enabled: bool + :keyword configuration: configuration for Microsoft Defender for Endpoint autoprovisioning. + :paramtype configuration: JSON + """ + super().__init__(**kwargs) + self.enabled = enabled + self.configuration = configuration + + +class DefenderForServersAwsOfferingSubPlan(_serialization.Model): + """configuration for the servers offering subPlan. + + :ivar type: The available sub plans. Known values are: "P1" and "P2". + :vartype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.SubPlan + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs): + """ + :keyword type: The available sub plans. Known values are: "P1" and "P2". + :paramtype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.SubPlan + """ + super().__init__(**kwargs) + self.type = type + + +class DefenderForServersAwsOfferingVaAutoProvisioning(_serialization.Model): + """The Vulnerability Assessment autoprovisioning configuration. + + :ivar enabled: Is Vulnerability Assessment auto provisioning enabled. + :vartype enabled: bool + :ivar configuration: configuration for Vulnerability Assessment autoprovisioning. + :vartype configuration: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "configuration": { + "key": "configuration", + "type": "DefenderForServersAwsOfferingVaAutoProvisioningConfiguration", + }, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + configuration: Optional["_models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration"] = None, + **kwargs + ): + """ + :keyword enabled: Is Vulnerability Assessment auto provisioning enabled. + :paramtype enabled: bool + :keyword configuration: configuration for Vulnerability Assessment autoprovisioning. + :paramtype configuration: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingVaAutoProvisioningConfiguration + """ + super().__init__(**kwargs) + self.enabled = enabled + self.configuration = configuration + + +class DefenderForServersAwsOfferingVaAutoProvisioningConfiguration(_serialization.Model): + """configuration for Vulnerability Assessment autoprovisioning. + + :ivar type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or + 'Qualys'. Known values are: "Qualys" and "TVM". + :vartype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.Type + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): + """ + :keyword type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or + 'Qualys'. Known values are: "Qualys" and "TVM". + :paramtype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.Type + """ + super().__init__(**kwargs) + self.type = type + + +class DefenderForServersAwsOfferingVmScanners(_serialization.Model): + """The Microsoft Defender for Server VM scanning configuration. + + :ivar enabled: Is Microsoft Defender for Server VM scanning enabled. + :vartype enabled: bool + :ivar configuration: configuration for Microsoft Defender for Server VM scanning. + :vartype configuration: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingVmScannersConfiguration + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "configuration": {"key": "configuration", "type": "DefenderForServersAwsOfferingVmScannersConfiguration"}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + configuration: Optional["_models.DefenderForServersAwsOfferingVmScannersConfiguration"] = None, + **kwargs + ): + """ + :keyword enabled: Is Microsoft Defender for Server VM scanning enabled. + :paramtype enabled: bool + :keyword configuration: configuration for Microsoft Defender for Server VM scanning. + :paramtype configuration: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersAwsOfferingVmScannersConfiguration + """ + super().__init__(**kwargs) + self.enabled = enabled + self.configuration = configuration + + +class DefenderForServersAwsOfferingVmScannersConfiguration(_serialization.Model): + """configuration for Microsoft Defender for Server VM scanning. + + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature. + :vartype cloud_role_arn: str + :ivar scanning_mode: The scanning mode for the vm scan. "Default" + :vartype scanning_mode: str or ~azure.mgmt.security.v2022_08_01_preview.models.ScanningMode + :ivar exclusion_tags: VM tags that indicates that VM should not be scanned. + :vartype exclusion_tags: dict[str, str] + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + "scanning_mode": {"key": "scanningMode", "type": "str"}, + "exclusion_tags": {"key": "exclusionTags", "type": "{str}"}, + } + + def __init__( + self, + *, + cloud_role_arn: Optional[str] = None, + scanning_mode: Optional[Union[str, "_models.ScanningMode"]] = None, + exclusion_tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. + :paramtype cloud_role_arn: str + :keyword scanning_mode: The scanning mode for the vm scan. "Default" + :paramtype scanning_mode: str or ~azure.mgmt.security.v2022_08_01_preview.models.ScanningMode + :keyword exclusion_tags: VM tags that indicates that VM should not be scanned. + :paramtype exclusion_tags: dict[str, str] + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + self.scanning_mode = scanning_mode + self.exclusion_tags = exclusion_tags + + +class DefenderForServersGcpOffering(CloudOffering): + """The Defender for Servers GCP offering configurations. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + :ivar defender_for_servers: The Defender for servers connection configuration. + :vartype defender_for_servers: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingDefenderForServers + :ivar arc_auto_provisioning: The ARC autoprovisioning configuration. + :vartype arc_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingArcAutoProvisioning + :ivar va_auto_provisioning: The Vulnerability Assessment autoprovisioning configuration. + :vartype va_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingVaAutoProvisioning + :ivar mde_auto_provisioning: The Microsoft Defender for Endpoint autoprovisioning + configuration. + :vartype mde_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingMdeAutoProvisioning + :ivar sub_plan: configuration for the servers offering subPlan. + :vartype sub_plan: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingSubPlan + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "defender_for_servers": { + "key": "defenderForServers", + "type": "DefenderForServersGcpOfferingDefenderForServers", + }, + "arc_auto_provisioning": { + "key": "arcAutoProvisioning", + "type": "DefenderForServersGcpOfferingArcAutoProvisioning", + }, + "va_auto_provisioning": { + "key": "vaAutoProvisioning", + "type": "DefenderForServersGcpOfferingVaAutoProvisioning", + }, + "mde_auto_provisioning": { + "key": "mdeAutoProvisioning", + "type": "DefenderForServersGcpOfferingMdeAutoProvisioning", + }, + "sub_plan": {"key": "subPlan", "type": "DefenderForServersGcpOfferingSubPlan"}, + } + + def __init__( + self, + *, + defender_for_servers: Optional["_models.DefenderForServersGcpOfferingDefenderForServers"] = None, + arc_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingArcAutoProvisioning"] = None, + va_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingVaAutoProvisioning"] = None, + mde_auto_provisioning: Optional["_models.DefenderForServersGcpOfferingMdeAutoProvisioning"] = None, + sub_plan: Optional["_models.DefenderForServersGcpOfferingSubPlan"] = None, + **kwargs + ): + """ + :keyword defender_for_servers: The Defender for servers connection configuration. + :paramtype defender_for_servers: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingDefenderForServers + :keyword arc_auto_provisioning: The ARC autoprovisioning configuration. + :paramtype arc_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingArcAutoProvisioning + :keyword va_auto_provisioning: The Vulnerability Assessment autoprovisioning configuration. + :paramtype va_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingVaAutoProvisioning + :keyword mde_auto_provisioning: The Microsoft Defender for Endpoint autoprovisioning + configuration. + :paramtype mde_auto_provisioning: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingMdeAutoProvisioning + :keyword sub_plan: configuration for the servers offering subPlan. + :paramtype sub_plan: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingSubPlan + """ + super().__init__(**kwargs) + self.offering_type = "DefenderForServersGcp" # type: str + self.defender_for_servers = defender_for_servers + self.arc_auto_provisioning = arc_auto_provisioning + self.va_auto_provisioning = va_auto_provisioning + self.mde_auto_provisioning = mde_auto_provisioning + self.sub_plan = sub_plan + + +class DefenderForServersGcpOfferingArcAutoProvisioning(_serialization.Model): + """The ARC autoprovisioning configuration. + + :ivar enabled: Is arc auto provisioning enabled. + :vartype enabled: bool + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, **kwargs): + """ + :keyword enabled: Is arc auto provisioning enabled. + :paramtype enabled: bool + """ + super().__init__(**kwargs) + self.enabled = enabled + + +class DefenderForServersGcpOfferingDefenderForServers(_serialization.Model): + """The Defender for servers connection configuration. + + :ivar workload_identity_provider_id: The workload identity provider id in GCP for this feature. + :vartype workload_identity_provider_id: str + :ivar service_account_email_address: The service account email address in GCP for this feature. + :vartype service_account_email_address: str + """ + + _attribute_map = { + "workload_identity_provider_id": {"key": "workloadIdentityProviderId", "type": "str"}, + "service_account_email_address": {"key": "serviceAccountEmailAddress", "type": "str"}, + } + + def __init__( + self, + *, + workload_identity_provider_id: Optional[str] = None, + service_account_email_address: Optional[str] = None, + **kwargs + ): + """ + :keyword workload_identity_provider_id: The workload identity provider id in GCP for this + feature. + :paramtype workload_identity_provider_id: str + :keyword service_account_email_address: The service account email address in GCP for this + feature. + :paramtype service_account_email_address: str + """ + super().__init__(**kwargs) + self.workload_identity_provider_id = workload_identity_provider_id + self.service_account_email_address = service_account_email_address + + +class DefenderForServersGcpOfferingMdeAutoProvisioning(_serialization.Model): + """The Microsoft Defender for Endpoint autoprovisioning configuration. + + :ivar enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. + :vartype enabled: bool + :ivar configuration: configuration for Microsoft Defender for Endpoint autoprovisioning. + :vartype configuration: JSON + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "configuration": {"key": "configuration", "type": "object"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, configuration: Optional[JSON] = None, **kwargs): + """ + :keyword enabled: Is Microsoft Defender for Endpoint auto provisioning enabled. + :paramtype enabled: bool + :keyword configuration: configuration for Microsoft Defender for Endpoint autoprovisioning. + :paramtype configuration: JSON + """ + super().__init__(**kwargs) + self.enabled = enabled + self.configuration = configuration + + +class DefenderForServersGcpOfferingSubPlan(_serialization.Model): + """configuration for the servers offering subPlan. + + :ivar type: The available sub plans. Known values are: "P1" and "P2". + :vartype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.SubPlan + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Optional[Union[str, "_models.SubPlan"]] = None, **kwargs): + """ + :keyword type: The available sub plans. Known values are: "P1" and "P2". + :paramtype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.SubPlan + """ + super().__init__(**kwargs) + self.type = type + + +class DefenderForServersGcpOfferingVaAutoProvisioning(_serialization.Model): + """The Vulnerability Assessment autoprovisioning configuration. + + :ivar enabled: Is Vulnerability Assessment auto provisioning enabled. + :vartype enabled: bool + :ivar configuration: configuration for Vulnerability Assessment autoprovisioning. + :vartype configuration: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "configuration": { + "key": "configuration", + "type": "DefenderForServersGcpOfferingVaAutoProvisioningConfiguration", + }, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + configuration: Optional["_models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration"] = None, + **kwargs + ): + """ + :keyword enabled: Is Vulnerability Assessment auto provisioning enabled. + :paramtype enabled: bool + :keyword configuration: configuration for Vulnerability Assessment autoprovisioning. + :paramtype configuration: + ~azure.mgmt.security.v2022_08_01_preview.models.DefenderForServersGcpOfferingVaAutoProvisioningConfiguration + """ + super().__init__(**kwargs) + self.enabled = enabled + self.configuration = configuration + + +class DefenderForServersGcpOfferingVaAutoProvisioningConfiguration(_serialization.Model): + """configuration for Vulnerability Assessment autoprovisioning. + + :ivar type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or + 'Qualys'. Known values are: "Qualys" and "TVM". + :vartype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.Type + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Optional[Union[str, "_models.Type"]] = None, **kwargs): + """ + :keyword type: The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or + 'Qualys'. Known values are: "Qualys" and "TVM". + :paramtype type: str or ~azure.mgmt.security.v2022_08_01_preview.models.Type + """ + super().__init__(**kwargs) + self.type = type + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ETag(_serialization.Model): + """Entity tag is used for comparing two or more entities from the same requested resource. + + :ivar etag: Entity tag is used for comparing two or more entities from the same requested + resource. + :vartype etag: str + """ + + _attribute_map = { + "etag": {"key": "etag", "type": "str"}, + } + + def __init__(self, *, etag: Optional[str] = None, **kwargs): + """ + :keyword etag: Entity tag is used for comparing two or more entities from the same requested + resource. + :paramtype etag: str + """ + super().__init__(**kwargs) + self.etag = etag + + +class GcpOrganizationalData(_serialization.Model): + """The gcpOrganization data. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + GcpOrganizationalDataMember, GcpOrganizationalDataOrganization + + All required parameters must be populated in order to send to Azure. + + :ivar organization_membership_type: The multi cloud account's membership type in the + organization. Required. Known values are: "Member" and "Organization". + :vartype organization_membership_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.OrganizationMembershipType + """ + + _validation = { + "organization_membership_type": {"required": True}, + } + + _attribute_map = { + "organization_membership_type": {"key": "organizationMembershipType", "type": "str"}, + } + + _subtype_map = { + "organization_membership_type": { + "Member": "GcpOrganizationalDataMember", + "Organization": "GcpOrganizationalDataOrganization", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.organization_membership_type = None # type: Optional[str] + + +class GcpOrganizationalDataMember(GcpOrganizationalData): + """The gcpOrganization data for the member account. + + All required parameters must be populated in order to send to Azure. + + :ivar organization_membership_type: The multi cloud account's membership type in the + organization. Required. Known values are: "Member" and "Organization". + :vartype organization_membership_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.OrganizationMembershipType + :ivar parent_hierarchy_id: If the multi cloud account is not of membership type organization, + this will be the ID of the project's parent. + :vartype parent_hierarchy_id: str + :ivar management_project_number: The GCP management project number from organizational + onboarding. + :vartype management_project_number: str + """ + + _validation = { + "organization_membership_type": {"required": True}, + } + + _attribute_map = { + "organization_membership_type": {"key": "organizationMembershipType", "type": "str"}, + "parent_hierarchy_id": {"key": "parentHierarchyId", "type": "str"}, + "management_project_number": {"key": "managementProjectNumber", "type": "str"}, + } + + def __init__( + self, *, parent_hierarchy_id: Optional[str] = None, management_project_number: Optional[str] = None, **kwargs + ): + """ + :keyword parent_hierarchy_id: If the multi cloud account is not of membership type + organization, this will be the ID of the project's parent. + :paramtype parent_hierarchy_id: str + :keyword management_project_number: The GCP management project number from organizational + onboarding. + :paramtype management_project_number: str + """ + super().__init__(**kwargs) + self.organization_membership_type = "Member" # type: str + self.parent_hierarchy_id = parent_hierarchy_id + self.management_project_number = management_project_number + + +class GcpOrganizationalDataOrganization(GcpOrganizationalData): + """The gcpOrganization data for the parent account. + + All required parameters must be populated in order to send to Azure. + + :ivar organization_membership_type: The multi cloud account's membership type in the + organization. Required. Known values are: "Member" and "Organization". + :vartype organization_membership_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.OrganizationMembershipType + :ivar excluded_project_numbers: If the multi cloud account is of membership type organization, + list of accounts excluded from offering. + :vartype excluded_project_numbers: list[str] + :ivar service_account_email_address: The service account email address which represents the + organization level permissions container. + :vartype service_account_email_address: str + :ivar workload_identity_provider_id: The GCP workload identity provider id which represents the + permissions required to auto provision security connectors. + :vartype workload_identity_provider_id: str + """ + + _validation = { + "organization_membership_type": {"required": True}, + } + + _attribute_map = { + "organization_membership_type": {"key": "organizationMembershipType", "type": "str"}, + "excluded_project_numbers": {"key": "excludedProjectNumbers", "type": "[str]"}, + "service_account_email_address": {"key": "serviceAccountEmailAddress", "type": "str"}, + "workload_identity_provider_id": {"key": "workloadIdentityProviderId", "type": "str"}, + } + + def __init__( + self, + *, + excluded_project_numbers: Optional[List[str]] = None, + service_account_email_address: Optional[str] = None, + workload_identity_provider_id: Optional[str] = None, + **kwargs + ): + """ + :keyword excluded_project_numbers: If the multi cloud account is of membership type + organization, list of accounts excluded from offering. + :paramtype excluded_project_numbers: list[str] + :keyword service_account_email_address: The service account email address which represents the + organization level permissions container. + :paramtype service_account_email_address: str + :keyword workload_identity_provider_id: The GCP workload identity provider id which represents + the permissions required to auto provision security connectors. + :paramtype workload_identity_provider_id: str + """ + super().__init__(**kwargs) + self.organization_membership_type = "Organization" # type: str + self.excluded_project_numbers = excluded_project_numbers + self.service_account_email_address = service_account_email_address + self.workload_identity_provider_id = workload_identity_provider_id + + +class GcpProjectDetails(_serialization.Model): + """The details about the project represented by the security connector. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar project_number: The unique GCP Project number. + :vartype project_number: str + :ivar project_id: The GCP Project id. + :vartype project_id: str + :ivar workload_identity_pool_id: The GCP workload identity federation pool id. + :vartype workload_identity_pool_id: str + """ + + _validation = { + "workload_identity_pool_id": {"readonly": True}, + } + + _attribute_map = { + "project_number": {"key": "projectNumber", "type": "str"}, + "project_id": {"key": "projectId", "type": "str"}, + "workload_identity_pool_id": {"key": "workloadIdentityPoolId", "type": "str"}, + } + + def __init__(self, *, project_number: Optional[str] = None, project_id: Optional[str] = None, **kwargs): + """ + :keyword project_number: The unique GCP Project number. + :paramtype project_number: str + :keyword project_id: The GCP Project id. + :paramtype project_id: str + """ + super().__init__(**kwargs) + self.project_number = project_number + self.project_id = project_id + self.workload_identity_pool_id = None + + +class GcpProjectEnvironmentData(EnvironmentData): + """The GCP project connector environment data. + + All required parameters must be populated in order to send to Azure. + + :ivar environment_type: The type of the environment data. Required. Known values are: + "AwsAccount", "GcpProject", "GithubScope", and "AzureDevOpsScope". + :vartype environment_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.EnvironmentType + :ivar organizational_data: The Gcp project's organizational data. + :vartype organizational_data: + ~azure.mgmt.security.v2022_08_01_preview.models.GcpOrganizationalData + :ivar project_details: The Gcp project's details. + :vartype project_details: ~azure.mgmt.security.v2022_08_01_preview.models.GcpProjectDetails + """ + + _validation = { + "environment_type": {"required": True}, + } + + _attribute_map = { + "environment_type": {"key": "environmentType", "type": "str"}, + "organizational_data": {"key": "organizationalData", "type": "GcpOrganizationalData"}, + "project_details": {"key": "projectDetails", "type": "GcpProjectDetails"}, + } + + def __init__( + self, + *, + organizational_data: Optional["_models.GcpOrganizationalData"] = None, + project_details: Optional["_models.GcpProjectDetails"] = None, + **kwargs + ): + """ + :keyword organizational_data: The Gcp project's organizational data. + :paramtype organizational_data: + ~azure.mgmt.security.v2022_08_01_preview.models.GcpOrganizationalData + :keyword project_details: The Gcp project's details. + :paramtype project_details: ~azure.mgmt.security.v2022_08_01_preview.models.GcpProjectDetails + """ + super().__init__(**kwargs) + self.environment_type = "GcpProject" # type: str + self.organizational_data = organizational_data + self.project_details = project_details + + +class GithubScopeEnvironmentData(EnvironmentData): + """The github scope connector's environment data. + + All required parameters must be populated in order to send to Azure. + + :ivar environment_type: The type of the environment data. Required. Known values are: + "AwsAccount", "GcpProject", "GithubScope", and "AzureDevOpsScope". + :vartype environment_type: str or + ~azure.mgmt.security.v2022_08_01_preview.models.EnvironmentType + """ + + _validation = { + "environment_type": {"required": True}, + } + + _attribute_map = { + "environment_type": {"key": "environmentType", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.environment_type = "GithubScope" # type: str + + +class InformationProtectionAwsOffering(CloudOffering): + """The information protection for AWS offering. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar offering_type: The type of the security offering. Required. Known values are: + "CspmMonitorAws", "DefenderForContainersAws", "DefenderForServersAws", + "DefenderForDatabasesAws", "InformationProtectionAws", "CspmMonitorGcp", "CspmMonitorGithub", + "CspmMonitorAzureDevOps", "DefenderForServersGcp", "DefenderForContainersGcp", + "DefenderForDatabasesGcp", "DefenderCspmAws", "DefenderCspmGcp", "DefenderForDevOpsGithub", and + "DefenderForDevOpsAzureDevOps". + :vartype offering_type: str or ~azure.mgmt.security.v2022_08_01_preview.models.OfferingType + :ivar description: The offering description. + :vartype description: str + :ivar information_protection: The native cloud connection configuration. + :vartype information_protection: + ~azure.mgmt.security.v2022_08_01_preview.models.InformationProtectionAwsOfferingInformationProtection + """ + + _validation = { + "offering_type": {"required": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "offering_type": {"key": "offeringType", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "information_protection": { + "key": "informationProtection", + "type": "InformationProtectionAwsOfferingInformationProtection", + }, + } + + def __init__( + self, + *, + information_protection: Optional["_models.InformationProtectionAwsOfferingInformationProtection"] = None, + **kwargs + ): + """ + :keyword information_protection: The native cloud connection configuration. + :paramtype information_protection: + ~azure.mgmt.security.v2022_08_01_preview.models.InformationProtectionAwsOfferingInformationProtection + """ + super().__init__(**kwargs) + self.offering_type = "InformationProtectionAws" # type: str + self.information_protection = information_protection + + +class InformationProtectionAwsOfferingInformationProtection(_serialization.Model): + """The native cloud connection configuration. + + :ivar cloud_role_arn: The cloud role ARN in AWS for this feature. + :vartype cloud_role_arn: str + """ + + _attribute_map = { + "cloud_role_arn": {"key": "cloudRoleArn", "type": "str"}, + } + + def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs): + """ + :keyword cloud_role_arn: The cloud role ARN in AWS for this feature. + :paramtype cloud_role_arn: str + """ + super().__init__(**kwargs) + self.cloud_role_arn = cloud_role_arn + + +class Kind(_serialization.Model): + """Describes an Azure resource with kind. + + :ivar kind: Kind of the resource. + :vartype kind: str + """ + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + } + + def __init__(self, *, kind: Optional[str] = None, **kwargs): + """ + :keyword kind: Kind of the resource. + :paramtype kind: str + """ + super().__init__(**kwargs) + self.kind = kind + + +class Resource(_serialization.Model): + """Describes an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :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): + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class Tags(_serialization.Model): + """A list of key value pairs that describe the resource. + + :ivar tags: A list of key value pairs that describe the resource. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + """ + :keyword tags: A list of key value pairs that describe the resource. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class TrackedResource(Resource, AzureTrackedResourceLocation, Kind, ETag, Tags): + """Describes an Azure tracked resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tags: A list of key value pairs that describe the resource. + :vartype tags: dict[str, str] + :ivar etag: Entity tag is used for comparing two or more entities from the same requested + resource. + :vartype etag: str + :ivar kind: Kind of the resource. + :vartype kind: str + :ivar location: Location where the resource is stored. + :vartype location: str + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + kind: Optional[str] = None, + location: Optional[str] = None, + **kwargs + ): + """ + :keyword tags: A list of key value pairs that describe the resource. + :paramtype tags: dict[str, str] + :keyword etag: Entity tag is used for comparing two or more entities from the same requested + resource. + :paramtype etag: str + :keyword kind: Kind of the resource. + :paramtype kind: str + :keyword location: Location where the resource is stored. + :paramtype location: str + """ + super().__init__(location=location, kind=kind, etag=etag, tags=tags, **kwargs) + self.tags = tags + self.etag = etag + self.kind = kind + self.location = location + self.id = None + self.name = None + self.type = None + + +class SecurityConnector(TrackedResource): # pylint: disable=too-many-instance-attributes + """The security connector resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tags: A list of key value pairs that describe the resource. + :vartype tags: dict[str, str] + :ivar etag: Entity tag is used for comparing two or more entities from the same requested + resource. + :vartype etag: str + :ivar kind: Kind of the resource. + :vartype kind: str + :ivar location: Location where the resource is stored. + :vartype location: str + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.security.v2022_08_01_preview.models.SystemData + :ivar hierarchy_identifier: The multi cloud resource identifier (account id in case of AWS + connector, project number in case of GCP connector). + :vartype hierarchy_identifier: str + :ivar hierarchy_identifier_trial_end_date: The date on which the trial period will end, if + applicable. Trial period exists for 30 days after upgrading to payed offerings. + :vartype hierarchy_identifier_trial_end_date: ~datetime.datetime + :ivar environment_name: The multi cloud resource's cloud name. Known values are: "Azure", + "AWS", "GCP", "Github", and "AzureDevOps". + :vartype environment_name: str or ~azure.mgmt.security.v2022_08_01_preview.models.CloudName + :ivar offerings: A collection of offerings for the security connector. + :vartype offerings: list[~azure.mgmt.security.v2022_08_01_preview.models.CloudOffering] + :ivar environment_data: The security connector environment data. + :vartype environment_data: ~azure.mgmt.security.v2022_08_01_preview.models.EnvironmentData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "hierarchy_identifier_trial_end_date": {"readonly": True}, + } + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "hierarchy_identifier": {"key": "properties.hierarchyIdentifier", "type": "str"}, + "hierarchy_identifier_trial_end_date": { + "key": "properties.hierarchyIdentifierTrialEndDate", + "type": "iso-8601", + }, + "environment_name": {"key": "properties.environmentName", "type": "str"}, + "offerings": {"key": "properties.offerings", "type": "[CloudOffering]"}, + "environment_data": {"key": "properties.environmentData", "type": "EnvironmentData"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + kind: Optional[str] = None, + location: Optional[str] = None, + hierarchy_identifier: Optional[str] = None, + environment_name: Optional[Union[str, "_models.CloudName"]] = None, + offerings: Optional[List["_models.CloudOffering"]] = None, + environment_data: Optional["_models.EnvironmentData"] = None, + **kwargs + ): + """ + :keyword tags: A list of key value pairs that describe the resource. + :paramtype tags: dict[str, str] + :keyword etag: Entity tag is used for comparing two or more entities from the same requested + resource. + :paramtype etag: str + :keyword kind: Kind of the resource. + :paramtype kind: str + :keyword location: Location where the resource is stored. + :paramtype location: str + :keyword hierarchy_identifier: The multi cloud resource identifier (account id in case of AWS + connector, project number in case of GCP connector). + :paramtype hierarchy_identifier: str + :keyword environment_name: The multi cloud resource's cloud name. Known values are: "Azure", + "AWS", "GCP", "Github", and "AzureDevOps". + :paramtype environment_name: str or ~azure.mgmt.security.v2022_08_01_preview.models.CloudName + :keyword offerings: A collection of offerings for the security connector. + :paramtype offerings: list[~azure.mgmt.security.v2022_08_01_preview.models.CloudOffering] + :keyword environment_data: The security connector environment data. + :paramtype environment_data: ~azure.mgmt.security.v2022_08_01_preview.models.EnvironmentData + """ + super().__init__(tags=tags, etag=etag, kind=kind, location=location, **kwargs) + self.system_data = None + self.hierarchy_identifier = hierarchy_identifier + self.hierarchy_identifier_trial_end_date = None + self.environment_name = environment_name + self.offerings = offerings + self.environment_data = environment_data + + +class SecurityConnectorsList(_serialization.Model): + """List of security connectors response. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: The list of security connectors under the given scope. Required. + :vartype value: list[~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector] + :ivar next_link: The URI to fetch the next page. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SecurityConnector]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: List["_models.SecurityConnector"], **kwargs): + """ + :keyword value: The list of security connectors under the given scope. Required. + :paramtype value: list[~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +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.security.v2022_08_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.security.v2022_08_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 + ): + """ + :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.security.v2022_08_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.security.v2022_08_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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# 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/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_security_center_enums.py new file mode 100644 index 000000000000..dfcd185f366a --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/models/_security_center_enums.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class CloudName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The multi cloud resource's cloud name.""" + + AZURE = "Azure" + AWS = "AWS" + GCP = "GCP" + GITHUB = "Github" + AZURE_DEV_OPS = "AzureDevOps" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class EnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the environment data.""" + + AWS_ACCOUNT = "AwsAccount" + GCP_PROJECT = "GcpProject" + GITHUB_SCOPE = "GithubScope" + AZURE_DEV_OPS_SCOPE = "AzureDevOpsScope" + + +class OfferingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the security offering.""" + + CSPM_MONITOR_AWS = "CspmMonitorAws" + DEFENDER_FOR_CONTAINERS_AWS = "DefenderForContainersAws" + DEFENDER_FOR_SERVERS_AWS = "DefenderForServersAws" + DEFENDER_FOR_DATABASES_AWS = "DefenderForDatabasesAws" + INFORMATION_PROTECTION_AWS = "InformationProtectionAws" + CSPM_MONITOR_GCP = "CspmMonitorGcp" + CSPM_MONITOR_GITHUB = "CspmMonitorGithub" + CSPM_MONITOR_AZURE_DEV_OPS = "CspmMonitorAzureDevOps" + DEFENDER_FOR_SERVERS_GCP = "DefenderForServersGcp" + DEFENDER_FOR_CONTAINERS_GCP = "DefenderForContainersGcp" + DEFENDER_FOR_DATABASES_GCP = "DefenderForDatabasesGcp" + DEFENDER_CSPM_AWS = "DefenderCspmAws" + DEFENDER_CSPM_GCP = "DefenderCspmGcp" + DEFENDER_FOR_DEV_OPS_GITHUB = "DefenderForDevOpsGithub" + DEFENDER_FOR_DEV_OPS_AZURE_DEV_OPS = "DefenderForDevOpsAzureDevOps" + + +class OrganizationMembershipType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The multi cloud account's membership type in the organization.""" + + MEMBER = "Member" + ORGANIZATION = "Organization" + + +class ScanningMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The scanning mode for the vm scan.""" + + DEFAULT = "Default" + + +class SubPlan(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The available sub plans.""" + + P1 = "P1" + P2 = "P2" + + +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys'.""" + + QUALYS = "Qualys" + TVM = "TVM" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py new file mode 100644 index 000000000000..4660a96abf0f --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._security_connectors_operations import SecurityConnectorsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "SecurityConnectorsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_patch.py new file mode 100644 index 000000000000..f7dd32510333 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_patch.py @@ -0,0 +1,20 @@ +# ------------------------------------ +# 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/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py new file mode 100644 index 000000000000..908cc9cbd6fd --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py @@ -0,0 +1,858 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, 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.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from ..._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, security_connector_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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, security_connector_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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, security_connector_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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, security_connector_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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url( + "subscription_id", subscription_id, "str", pattern=r"^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$" + ), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class SecurityConnectorsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.security.v2022_08_01_preview.SecurityCenter`'s + :attr:`security_connectors` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: + """Lists all the security connectors in the specified subscription. Use the 'nextLink' property in + the response to get the next page of security connectors for the specified subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConnector or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + + error_map = { + 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, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors"} # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: + """Lists all the security connectors in the specified resource group. Use the 'nextLink' property + in the response to get the next page of security connectors for the specified resource group. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecurityConnector or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnectorsList] + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SecurityConnectorsList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors"} # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> _models.SecurityConnector: + """Retrieves details of a specific security connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + + request = build_get_request( + resource_group_name=resource_group_name, + security_connector_name=security_connector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityConnector", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: _models.SecurityConnector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityConnector: + """Creates or updates a security connector. If a security connector is already created and a + subsequent request is issued for the same security connector id, then it will be updated. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Required. + :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityConnector: + """Creates or updates a security connector. If a security connector is already created and a + subsequent request is issued for the same security connector id, then it will be updated. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Required. + :type security_connector: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: Union[_models.SecurityConnector, IO], + **kwargs: Any + ) -> _models.SecurityConnector: + """Creates or updates a security connector. If a security connector is already created and a + subsequent request is issued for the same security connector id, then it will be updated. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Is either a model type or a IO + type. Required. + :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_connector, (IO, bytes)): + _content = security_connector + else: + _json = self._serialize.body(security_connector, "SecurityConnector") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + security_connector_name=security_connector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SecurityConnector", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SecurityConnector", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + + @overload + def update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: _models.SecurityConnector, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityConnector: + """Updates a security connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Required. + :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SecurityConnector: + """Updates a security connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Required. + :type security_connector: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + security_connector_name: str, + security_connector: Union[_models.SecurityConnector, IO], + **kwargs: Any + ) -> _models.SecurityConnector: + """Updates a security connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :param security_connector: The security connector resource. Is either a model type or a IO + type. Required. + :type security_connector: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecurityConnector or the result of cls(response) + :rtype: ~azure.mgmt.security.v2022_08_01_preview.models.SecurityConnector + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + cls = kwargs.pop("cls", None) # type: ClsType[_models.SecurityConnector] + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(security_connector, (IO, bytes)): + _content = security_connector + else: + _json = self._serialize.body(security_connector, "SecurityConnector") + + request = build_update_request( + resource_group_name=resource_group_name, + security_connector_name=security_connector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SecurityConnector", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, security_connector_name: str, **kwargs: Any + ) -> None: + """Deletes a security connector. + + :param resource_group_name: The name of the resource group within the user's subscription. The + name is case insensitive. Required. + :type resource_group_name: str + :param security_connector_name: The security connector name. Required. + :type security_connector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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 = kwargs.pop( + "api_version", _params.pop("api-version", "2022-08-01-preview") + ) # type: Literal["2022-08-01-preview"] + cls = kwargs.pop("cls", None) # type: ClsType[None] + + request = build_delete_request( + resource_group_name=resource_group_name, + security_connector_name=security_connector_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}"} # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/py.typed b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file