diff --git a/sdk/security/azure-mgmt-security/_meta.json b/sdk/security/azure-mgmt-security/_meta.json index d2dee5a74e00..e3c23e517a20 100644 --- a/sdk/security/azure-mgmt-security/_meta.json +++ b/sdk/security/azure-mgmt-security/_meta.json @@ -1,11 +1,39 @@ { - "commit": "a3974594e96506c6fa921be80f349d67b555e534", + "commit": "6dbf7fb82d4c91c548767f2a8da6961ea8aa1ba9", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/security/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", - "readme": "specification/security/resource-manager/readme.md" + "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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "readme": "specification/security/resource-manager/readme.md", + "package-preview-2023-03-only": "2023-03-23 11:34:42 +0200 2db2beee2fed67b08d273fdac7a51aba02ac2f80 Microsoft.Security/preview/2023-03-01-preview/securityConnectors.json", + "package-preview-2023-02-only": "2023-03-10 09:31:28 +0200 a2e2617050e68ae1c445db565076c5a7f42ebad4 Microsoft.Security/preview/2023-02-01-preview/healthReports.json", + "package-preview-2023-01-only": "2023-03-28 11:35:29 +0300 0e2c3d175e126284c5db1d3099b61e46e462fb74 Microsoft.Security/preview/2023-01-01-preview/securityOperators.json", + "package-2023-01": "2023-03-27 17:16:35 +0300 efd2b52bcf2b06e174f7008b2728f70ee7f972bd Microsoft.Security/stable/2023-01-01/pricings.json", + "package-preview-2022-08": "2022-09-20 03:45:43 +0300 9000eea3aa90071c2814f663dd763d7fc1668bed Microsoft.Security/preview/2022-08-01-preview/securityConnectors.json", + "package-preview-2022-07": "2022-11-01 04:47:16 +0200 312544c27464f61bf9639924099d4238bdfa1d71 Microsoft.Security/preview/2022-07-01-preview/applications.json", + "package-2022-05": "2022-06-09 12:47:24 +0300 d006e1d15d8fe19a6c558861dd5bba6b7baa8dd8 Microsoft.Security/stable/2022-05-01/settings.json", + "package-preview-2022-11": "2022-11-14 21:43:58 -0800 38995aeb1e63c781ae7c2cd176ea444480638093 Microsoft.Security/preview/2022-11-20-preview/apiCollections.json", + "package-preview-2022-05": "2022-06-24 06:02:22 +0300 0f8b747471c2bcae823c874e24e1b54726673a3a Microsoft.Security/preview/2022-05-01-preview/securityConnectors.json", + "package-2022-03": "2022-08-08 05:50:55 +0300 63312d0231ed57559b7f85548137cde356b98e57 Microsoft.Security/stable/2022-03-01/pricings.json", + "package-2022-01-only": "2023-03-02 10:05:39 +0800 c287c0fb1c00df4bb1812acec050d178fa969cb6 Microsoft.Security/stable/2022-01-01/alerts.json", + "package-2022-01-preview-only": "2023-01-24 09:46:27 +0200 9eb9c45842ba2932eee57326189019adc3018397 Microsoft.Security/preview/2022-01-01-preview/governanceRules.json", + "package-2021-10-preview-only": "2021-10-22 08:18:20 +0300 32652d34b63d39b2c9ca52cf97e2f805b881dd4a Microsoft.Security/preview/2021-10-01-preview/mdeOnboardings.json", + "package-2021-07-preview-only": "2022-02-16 05:25:20 +0200 72808f0e1bef87104ed97735158547422acb3d17 Microsoft.Security/preview/2021-07-01-preview/customAssessmentAutomation.json", + "package-2021-07-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/stable/2021-07-01/settings.json", + "package-2021-06-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/stable/2021-06-01/settings.json", + "package-2021-05-preview-only": "2021-05-20 10:54:13 +0300 5fcc6854765009e891052653b304cfe80353430a Microsoft.Security/preview/2021-05-01-preview/softwareInventories.json", + "package-2021-01-only": "2021-02-23 03:48:25 +0200 605f17bf33f419ee5cd3899f3ff799318a7caeb1 Microsoft.Security/stable/2021-01-01/alerts.json", + "package-2020-07-preview-only": "2020-10-28 04:54:24 +0200 f8440e900cea52b8347f63f9a755d1feeae6f161 Microsoft.Security/preview/2020-07-01-preview/sqlVulnerabilityAssessmentsScanResultsOperations.json", + "package-2020-01-python-only": "2022-05-17 18:32:46 +0300 9896393247d4098e6ff91944d2471385efaac804 Microsoft.Security/stable/2020-01-01/topologies.json", + "package-2020-01-preview-python-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/preview/2020-01-01-preview/connectors.json", + "package-2019-08-python-only": "2021-01-04 04:26:12 +0200 e5c779c267ed9d5ae7115ca71e16f3a6e6152bdd Microsoft.Security/stable/2019-08-01/iotSecuritySolutions.json", + "package-2019-01-python-only": "2022-02-23 11:14:18 +0800 8aa184e00b5314f9e293db0401e002cb99c85a91 Microsoft.Security/stable/2019-01-01/advancedThreatProtectionSettings.json", + "package-2019-01-preview-python-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/preview/2019-01-01-preview/subAssessments.json", + "package-2018-06-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/stable/2018-06-01/pricings.json", + "package-2017-08-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/stable/2017-08-01/complianceResults.json", + "package-2017-08-preview-python-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/preview/2017-08-01-preview/securityContacts.json", + "package-2015-06-preview-python-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/preview/2015-06-01-preview/tasks.json" } \ 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 264dbd194175..8ecf00bc53c8 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 @@ -124,6 +124,8 @@ def __init__( profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): + if api_version: + kwargs.setdefault('api_version', api_version) self._config = SecurityCenterConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(SecurityCenter, self).__init__( @@ -270,7 +272,7 @@ def adaptive_application_controls(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def adaptive_network_hardenings(self): @@ -284,7 +286,7 @@ def adaptive_network_hardenings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def advanced_threat_protection(self): @@ -298,7 +300,7 @@ def advanced_threat_protection(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def alerts(self): @@ -315,7 +317,7 @@ def alerts(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def alerts_suppression_rules(self): @@ -329,7 +331,7 @@ def alerts_suppression_rules(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def allowed_connections(self): @@ -343,7 +345,7 @@ def allowed_connections(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def api_collection(self): @@ -357,7 +359,7 @@ def api_collection(self): else: raise ValueError("API version {} does not have operation group 'api_collection'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def api_collection_offboarding(self): @@ -371,7 +373,7 @@ def api_collection_offboarding(self): else: raise ValueError("API version {} does not have operation group 'api_collection_offboarding'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def api_collection_onboarding(self): @@ -385,7 +387,7 @@ def api_collection_onboarding(self): else: raise ValueError("API version {} does not have operation group 'api_collection_onboarding'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def application(self): @@ -399,7 +401,7 @@ def application(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def applications(self): @@ -413,7 +415,7 @@ def applications(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def assessments(self): @@ -430,7 +432,7 @@ def assessments(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def assessments_metadata(self): @@ -447,7 +449,7 @@ def assessments_metadata(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def auto_provisioning_settings(self): @@ -461,7 +463,7 @@ def auto_provisioning_settings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def automations(self): @@ -475,7 +477,7 @@ def automations(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def compliance_results(self): @@ -489,7 +491,7 @@ def compliance_results(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def compliances(self): @@ -503,7 +505,7 @@ def compliances(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def connectors(self): @@ -517,7 +519,7 @@ def connectors(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def custom_assessment_automations(self): @@ -531,7 +533,7 @@ def custom_assessment_automations(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def custom_entity_store_assignments(self): @@ -545,7 +547,7 @@ def custom_entity_store_assignments(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def device_security_groups(self): @@ -559,7 +561,7 @@ def device_security_groups(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def discovered_security_solutions(self): @@ -573,7 +575,7 @@ def discovered_security_solutions(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def external_security_solutions(self): @@ -587,7 +589,7 @@ def external_security_solutions(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def governance_assignments(self): @@ -601,7 +603,7 @@ def governance_assignments(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def governance_rules(self): @@ -615,7 +617,7 @@ def governance_rules(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def health_report(self): @@ -629,7 +631,7 @@ def health_report(self): else: raise ValueError("API version {} does not have operation group 'health_report'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def health_reports(self): @@ -643,7 +645,7 @@ def health_reports(self): else: raise ValueError("API version {} does not have operation group 'health_reports'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def information_protection_policies(self): @@ -657,7 +659,7 @@ def information_protection_policies(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def ingestion_settings(self): @@ -671,7 +673,7 @@ def ingestion_settings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def iot_security_solution(self): @@ -685,7 +687,7 @@ def iot_security_solution(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def iot_security_solution_analytics(self): @@ -699,7 +701,7 @@ def iot_security_solution_analytics(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def iot_security_solutions_analytics_aggregated_alert(self): @@ -713,7 +715,7 @@ def iot_security_solutions_analytics_aggregated_alert(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def iot_security_solutions_analytics_recommendation(self): @@ -727,7 +729,7 @@ def iot_security_solutions_analytics_recommendation(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def jit_network_access_policies(self): @@ -741,7 +743,7 @@ def jit_network_access_policies(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def locations(self): @@ -755,7 +757,7 @@ def locations(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def mde_onboardings(self): @@ -769,7 +771,7 @@ def mde_onboardings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -783,7 +785,7 @@ def operations(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def pricings(self): @@ -803,7 +805,7 @@ def pricings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def regulatory_compliance_assessments(self): @@ -817,7 +819,7 @@ def regulatory_compliance_assessments(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def regulatory_compliance_controls(self): @@ -831,7 +833,7 @@ def regulatory_compliance_controls(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def regulatory_compliance_standards(self): @@ -845,7 +847,7 @@ def regulatory_compliance_standards(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def secure_score_control_definitions(self): @@ -859,7 +861,7 @@ def secure_score_control_definitions(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def secure_score_controls(self): @@ -873,7 +875,7 @@ def secure_score_controls(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def secure_scores(self): @@ -887,7 +889,7 @@ def secure_scores(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_connector_application(self): @@ -901,7 +903,7 @@ def security_connector_application(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_connector_applications(self): @@ -915,7 +917,7 @@ def security_connector_applications(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_connectors(self): @@ -938,7 +940,7 @@ def security_connectors(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_contacts(self): @@ -952,7 +954,7 @@ def security_contacts(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_operators(self): @@ -966,7 +968,7 @@ def security_operators(self): else: raise ValueError("API version {} does not have operation group 'security_operators'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_solutions(self): @@ -980,7 +982,7 @@ def security_solutions(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_solutions_reference_data(self): @@ -994,7 +996,7 @@ def security_solutions_reference_data(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def server_vulnerability_assessment(self): @@ -1008,7 +1010,7 @@ def server_vulnerability_assessment(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def settings(self): @@ -1028,7 +1030,7 @@ def settings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def software_inventories(self): @@ -1042,7 +1044,7 @@ def software_inventories(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def sql_vulnerability_assessment_baseline_rules(self): @@ -1059,7 +1061,7 @@ def sql_vulnerability_assessment_baseline_rules(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def sql_vulnerability_assessment_scan_results(self): @@ -1076,7 +1078,7 @@ def sql_vulnerability_assessment_scan_results(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def sql_vulnerability_assessment_scans(self): @@ -1093,7 +1095,7 @@ def sql_vulnerability_assessment_scans(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def sub_assessments(self): @@ -1107,7 +1109,7 @@ def sub_assessments(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def tasks(self): @@ -1121,7 +1123,7 @@ def tasks(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def topology(self): @@ -1135,7 +1137,7 @@ def topology(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def workspace_settings(self): @@ -1149,7 +1151,7 @@ def workspace_settings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) def close(self): self._client.close() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py index e3cc6ce6ed6f..a00658b1fc19 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py @@ -664,8 +664,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -743,6 +744,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -751,10 +754,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get('skip_quote', False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -893,6 +894,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -905,9 +908,18 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get('do_quote', False): + serialized = [ + '' if s is None else quote(str(s), safe='') + for s + in serialized + ] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -952,7 +964,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: 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 96a0e28100b5..61a125b14c2d 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 @@ -124,6 +124,8 @@ def __init__( profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: + if api_version: + kwargs.setdefault('api_version', api_version) self._config = SecurityCenterConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(SecurityCenter, self).__init__( @@ -270,7 +272,7 @@ def adaptive_application_controls(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def adaptive_network_hardenings(self): @@ -284,7 +286,7 @@ def adaptive_network_hardenings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def advanced_threat_protection(self): @@ -298,7 +300,7 @@ def advanced_threat_protection(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def alerts(self): @@ -315,7 +317,7 @@ def alerts(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def alerts_suppression_rules(self): @@ -329,7 +331,7 @@ def alerts_suppression_rules(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def allowed_connections(self): @@ -343,7 +345,7 @@ def allowed_connections(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def api_collection(self): @@ -357,7 +359,7 @@ def api_collection(self): else: raise ValueError("API version {} does not have operation group 'api_collection'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def api_collection_offboarding(self): @@ -371,7 +373,7 @@ def api_collection_offboarding(self): else: raise ValueError("API version {} does not have operation group 'api_collection_offboarding'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def api_collection_onboarding(self): @@ -385,7 +387,7 @@ def api_collection_onboarding(self): else: raise ValueError("API version {} does not have operation group 'api_collection_onboarding'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def application(self): @@ -399,7 +401,7 @@ def application(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def applications(self): @@ -413,7 +415,7 @@ def applications(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def assessments(self): @@ -430,7 +432,7 @@ def assessments(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def assessments_metadata(self): @@ -447,7 +449,7 @@ def assessments_metadata(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def auto_provisioning_settings(self): @@ -461,7 +463,7 @@ def auto_provisioning_settings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def automations(self): @@ -475,7 +477,7 @@ def automations(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def compliance_results(self): @@ -489,7 +491,7 @@ def compliance_results(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def compliances(self): @@ -503,7 +505,7 @@ def compliances(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def connectors(self): @@ -517,7 +519,7 @@ def connectors(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def custom_assessment_automations(self): @@ -531,7 +533,7 @@ def custom_assessment_automations(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def custom_entity_store_assignments(self): @@ -545,7 +547,7 @@ def custom_entity_store_assignments(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def device_security_groups(self): @@ -559,7 +561,7 @@ def device_security_groups(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def discovered_security_solutions(self): @@ -573,7 +575,7 @@ def discovered_security_solutions(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def external_security_solutions(self): @@ -587,7 +589,7 @@ def external_security_solutions(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def governance_assignments(self): @@ -601,7 +603,7 @@ def governance_assignments(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def governance_rules(self): @@ -615,7 +617,7 @@ def governance_rules(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def health_report(self): @@ -629,7 +631,7 @@ def health_report(self): else: raise ValueError("API version {} does not have operation group 'health_report'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def health_reports(self): @@ -643,7 +645,7 @@ def health_reports(self): else: raise ValueError("API version {} does not have operation group 'health_reports'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def information_protection_policies(self): @@ -657,7 +659,7 @@ def information_protection_policies(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def ingestion_settings(self): @@ -671,7 +673,7 @@ def ingestion_settings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def iot_security_solution(self): @@ -685,7 +687,7 @@ def iot_security_solution(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def iot_security_solution_analytics(self): @@ -699,7 +701,7 @@ def iot_security_solution_analytics(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def iot_security_solutions_analytics_aggregated_alert(self): @@ -713,7 +715,7 @@ def iot_security_solutions_analytics_aggregated_alert(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def iot_security_solutions_analytics_recommendation(self): @@ -727,7 +729,7 @@ def iot_security_solutions_analytics_recommendation(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def jit_network_access_policies(self): @@ -741,7 +743,7 @@ def jit_network_access_policies(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def locations(self): @@ -755,7 +757,7 @@ def locations(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def mde_onboardings(self): @@ -769,7 +771,7 @@ def mde_onboardings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def operations(self): @@ -783,7 +785,7 @@ def operations(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def pricings(self): @@ -803,7 +805,7 @@ def pricings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def regulatory_compliance_assessments(self): @@ -817,7 +819,7 @@ def regulatory_compliance_assessments(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def regulatory_compliance_controls(self): @@ -831,7 +833,7 @@ def regulatory_compliance_controls(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def regulatory_compliance_standards(self): @@ -845,7 +847,7 @@ def regulatory_compliance_standards(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def secure_score_control_definitions(self): @@ -859,7 +861,7 @@ def secure_score_control_definitions(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def secure_score_controls(self): @@ -873,7 +875,7 @@ def secure_score_controls(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def secure_scores(self): @@ -887,7 +889,7 @@ def secure_scores(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_connector_application(self): @@ -901,7 +903,7 @@ def security_connector_application(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_connector_applications(self): @@ -915,7 +917,7 @@ def security_connector_applications(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_connectors(self): @@ -938,7 +940,7 @@ def security_connectors(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_contacts(self): @@ -952,7 +954,7 @@ def security_contacts(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_operators(self): @@ -966,7 +968,7 @@ def security_operators(self): else: raise ValueError("API version {} does not have operation group 'security_operators'".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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_solutions(self): @@ -980,7 +982,7 @@ def security_solutions(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def security_solutions_reference_data(self): @@ -994,7 +996,7 @@ def security_solutions_reference_data(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def server_vulnerability_assessment(self): @@ -1008,7 +1010,7 @@ def server_vulnerability_assessment(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def settings(self): @@ -1028,7 +1030,7 @@ def settings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def software_inventories(self): @@ -1042,7 +1044,7 @@ def software_inventories(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def sql_vulnerability_assessment_baseline_rules(self): @@ -1059,7 +1061,7 @@ def sql_vulnerability_assessment_baseline_rules(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def sql_vulnerability_assessment_scan_results(self): @@ -1076,7 +1078,7 @@ def sql_vulnerability_assessment_scan_results(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def sql_vulnerability_assessment_scans(self): @@ -1093,7 +1095,7 @@ def sql_vulnerability_assessment_scans(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def sub_assessments(self): @@ -1107,7 +1109,7 @@ def sub_assessments(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def tasks(self): @@ -1121,7 +1123,7 @@ def tasks(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def topology(self): @@ -1135,7 +1137,7 @@ def topology(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) @property def workspace_settings(self): @@ -1149,7 +1151,7 @@ def workspace_settings(self): 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))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) async def close(self): await self._client.close() diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py index b7a9f475da5c..de0d8c74879d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py @@ -56,9 +56,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.tasks = TasksOperations(self._client, self._config, self._serialize, self._deserialize) + self.locations = LocationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-06-01-preview" + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2015-06-01-preview" + ) + self.tasks = TasksOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-06-01-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2015_06_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py index 3323fcd39041..aa5a656dd4de 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py @@ -56,9 +56,15 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.tasks = TasksOperations(self._client, self._config, self._serialize, self._deserialize) + self.locations = LocationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-06-01-preview" + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize, "2015-06-01-preview" + ) + self.tasks = TasksOperations( + self._client, self._config, self._serialize, self._deserialize, "2015-06-01-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 48c8c6dc1f06..fe3c820bab51 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.AscLocation"]: @@ -68,7 +69,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AscLocation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.AscLocationList] = kwargs.pop("cls", None) error_map = { @@ -159,7 +162,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: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.AscLocation] = kwargs.pop("cls", None) 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 baebf823e6b1..566e8428f790 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 @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -65,7 +66,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { 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 db91a87098bc..1bad47c7712c 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 @@ -60,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.SecurityTask"]: @@ -76,7 +77,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: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { @@ -165,7 +168,9 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { @@ -264,7 +269,9 @@ async def get_subscription_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_subscription_level_task_request( @@ -336,7 +343,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: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_task_state_request( @@ -393,7 +402,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { @@ -496,7 +507,9 @@ async def get_resource_group_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_resource_group_level_task_request( @@ -573,7 +586,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: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", 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/operations/_locations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py index 9c2d20dbebdb..8e0822713da3 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +80,7 @@ def build_get_request(asc_location: str, subscription_id: str, **kwargs: Any) -> "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,6 +109,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.AscLocation"]: @@ -125,7 +126,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.AscLocation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.AscLocationList] = kwargs.pop("cls", None) error_map = { @@ -216,7 +219,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: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.AscLocation] = kwargs.pop("cls", None) 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 5fec409b01e5..ce4a9e8934d7 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 @@ -73,6 +73,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -86,7 +87,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.OperationList] = kwargs.pop("cls", None) error_map = { 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 7958a48f535f..7d4854774fc3 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,7 +84,7 @@ def build_list_by_home_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,7 +119,7 @@ def build_get_subscription_level_task_request( "taskName": _SERIALIZER.url("task_name", task_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,7 +157,7 @@ def build_update_subscription_level_task_state_request( "taskUpdateActionType": _SERIALIZER.url("task_update_action_type", task_update_action_type, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,7 +192,7 @@ def build_list_by_resource_group_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -230,7 +230,7 @@ def build_get_resource_group_level_task_request( "taskName": _SERIALIZER.url("task_name", task_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -272,7 +272,7 @@ def build_update_resource_group_level_task_state_request( "taskUpdateActionType": _SERIALIZER.url("task_update_action_type", task_update_action_type, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -301,6 +301,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.SecurityTask"]: @@ -317,7 +318,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: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { @@ -406,7 +409,9 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { @@ -503,7 +508,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: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_subscription_level_task_request( @@ -575,7 +582,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: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_task_state_request( @@ -632,7 +641,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.SecurityTaskList] = kwargs.pop("cls", None) error_map = { @@ -735,7 +746,9 @@ def get_resource_group_level_task( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[_models.SecurityTask] = kwargs.pop("cls", None) request = build_get_resource_group_level_task_request( @@ -812,7 +825,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: str = kwargs.pop("api_version", _params.pop("api-version", "2015-06-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2015-06-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_task_state_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py index 62bc54c3d345..f933c3e773aa 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py @@ -48,7 +48,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.compliance_results = ComplianceResultsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-08-01" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2017_08_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py index 82ae1259e6d5..12d27877d42c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py @@ -48,7 +48,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.compliance_results = ComplianceResultsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-08-01" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 f01a643f0a60..22b79d79d070 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.ComplianceResult"]: @@ -70,7 +71,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-08-01")) cls: ClsType[_models.ComplianceResultList] = kwargs.pop("cls", None) error_map = { @@ -162,7 +163,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-08-01")) cls: ClsType[_models.ComplianceResult] = kwargs.pop("cls", None) 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 94ec12f61e8f..ddb8747005e0 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +76,7 @@ def build_get_request(resource_id: str, compliance_result_name: str, **kwargs: A "complianceResultName": _SERIALIZER.url("compliance_result_name", compliance_result_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,6 +105,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> Iterable["_models.ComplianceResult"]: @@ -122,7 +123,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-08-01")) cls: ClsType[_models.ComplianceResultList] = kwargs.pop("cls", None) error_map = { @@ -214,7 +215,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2017-08-01")) cls: ClsType[_models.ComplianceResult] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py index 4044f96477f0..12bb01198393 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py @@ -71,17 +71,19 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.auto_provisioning_settings = AutoProvisioningSettingsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-08-01-preview" + ) + self.compliances = CompliancesOperations( + self._client, self._config, self._serialize, self._deserialize, "2017-08-01-preview" ) - self.compliances = CompliancesOperations(self._client, self._config, self._serialize, self._deserialize) self.information_protection_policies = InformationProtectionPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-08-01-preview" ) self.security_contacts = SecurityContactsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-08-01-preview" ) self.workspace_settings = WorkspaceSettingsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-08-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2017_08_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py index 831356ffee4d..8c6a1769fa50 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py @@ -72,17 +72,19 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.auto_provisioning_settings = AutoProvisioningSettingsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-08-01-preview" + ) + self.compliances = CompliancesOperations( + self._client, self._config, self._serialize, self._deserialize, "2017-08-01-preview" ) - self.compliances = CompliancesOperations(self._client, self._config, self._serialize, self._deserialize) self.information_protection_policies = InformationProtectionPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-08-01-preview" ) self.security_contacts = SecurityContactsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-08-01-preview" ) self.workspace_settings = WorkspaceSettingsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2017-08-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 4b19b1ff3f37..9a9936976d04 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -56,6 +57,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.AutoProvisioningSetting"]: @@ -71,7 +73,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AutoProvisioningSetting" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.AutoProvisioningSettingList] = kwargs.pop("cls", None) error_map = { @@ -161,7 +165,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) request = build_get_request( @@ -270,14 +276,16 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(setting, (IO, bytes)): + if isinstance(setting, (IOBase, bytes)): _content = setting else: _json = self._serialize.body(setting, "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 cfb3bcaa1690..6ba0491d312d 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.Compliance"]: @@ -70,7 +71,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.ComplianceList] = kwargs.pop("cls", None) error_map = { @@ -164,7 +167,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.Compliance] = kwargs.pop("cls", None) 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 8d5d4c0f1afe..0eee792b027a 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -56,6 +57,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -90,7 +92,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) request = build_get_request( @@ -230,14 +234,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(information_protection_policy, (IO, bytes)): + if isinstance(information_protection_policy, (IOBase, bytes)): _content = information_protection_policy else: _json = self._serialize.body(information_protection_policy, "InformationProtectionPolicy") @@ -300,7 +306,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.InformationProtectionPolicyList] = kwargs.pop("cls", None) error_map = { 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 0825a84f7770..562aded9d26a 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -58,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityContact"]: @@ -72,7 +74,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityContact"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.SecurityContactList] = kwargs.pop("cls", None) error_map = { @@ -162,7 +166,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) request = build_get_request( @@ -271,14 +277,16 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_contact, (IO, bytes)): + if isinstance(security_contact, (IOBase, bytes)): _content = security_contact else: _json = self._serialize.body(security_contact, "SecurityContact") @@ -343,7 +351,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -448,14 +458,16 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_contact, (IO, bytes)): + if isinstance(security_contact, (IOBase, bytes)): _content = security_contact else: _json = self._serialize.body(security_contact, "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 6c2b27d78f67..2e4f1317db1d 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -58,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.WorkspaceSetting"]: @@ -73,7 +75,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.WorkspaceSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.WorkspaceSettingList] = kwargs.pop("cls", None) error_map = { @@ -164,7 +168,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) request = build_get_request( @@ -278,14 +284,16 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workspace_setting, (IO, bytes)): + if isinstance(workspace_setting, (IOBase, bytes)): _content = workspace_setting else: _json = self._serialize.body(workspace_setting, "WorkspaceSetting") @@ -404,14 +412,16 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workspace_setting, (IO, bytes)): + if isinstance(workspace_setting, (IOBase, bytes)): _content = workspace_setting else: _json = self._serialize.body(workspace_setting, "WorkspaceSetting") @@ -477,7 +487,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", 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 85442edc4a61..a92052cf058a 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_get_request(setting_name: str, subscription_id: str, **kwargs: Any) -> "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +115,7 @@ def build_create_request(setting_name: str, subscription_id: str, **kwargs: Any) "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,6 +146,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.AutoProvisioningSetting"]: @@ -160,7 +162,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.AutoProvisioningSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.AutoProvisioningSettingList] = kwargs.pop("cls", None) error_map = { @@ -250,7 +254,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) request = build_get_request( @@ -359,14 +365,16 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutoProvisioningSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(setting, (IO, bytes)): + if isinstance(setting, (IOBase, bytes)): _content = setting else: _json = self._serialize.body(setting, "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 c4cdcd9ebb7e..5349d94671be 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,7 +74,7 @@ def build_get_request(scope: str, compliance_name: str, **kwargs: Any) -> HttpRe "complianceName": _SERIALIZER.url("compliance_name", compliance_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,6 +103,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> Iterable["_models.Compliance"]: @@ -121,7 +122,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.ComplianceList] = kwargs.pop("cls", None) error_map = { @@ -215,7 +218,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.Compliance] = kwargs.pop("cls", None) 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 cd5e6e5f5b24..5173e239bd52 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +58,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +91,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +117,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,6 +146,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -179,7 +181,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) request = build_get_request( @@ -319,14 +323,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.InformationProtectionPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(information_protection_policy, (IO, bytes)): + if isinstance(information_protection_policy, (IOBase, bytes)): _content = information_protection_policy else: _json = self._serialize.body(information_protection_policy, "InformationProtectionPolicy") @@ -389,7 +395,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.InformationProtectionPolicyList] = kwargs.pop("cls", None) error_map = { 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 d7068bf2e8d4..a3a788c2d823 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +82,7 @@ def build_get_request(security_contact_name: str, subscription_id: str, **kwargs "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,7 +113,7 @@ def build_create_request(security_contact_name: str, subscription_id: str, **kwa "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,7 +145,7 @@ def build_delete_request(security_contact_name: str, subscription_id: str, **kwa "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,7 +176,7 @@ def build_update_request(security_contact_name: str, subscription_id: str, **kwa "securityContactName": _SERIALIZER.url("security_contact_name", security_contact_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,6 +207,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.SecurityContact"]: @@ -220,7 +222,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityContact"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.SecurityContactList] = kwargs.pop("cls", None) error_map = { @@ -310,7 +314,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) request = build_get_request( @@ -419,14 +425,16 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_contact, (IO, bytes)): + if isinstance(security_contact, (IOBase, bytes)): _content = security_contact else: _json = self._serialize.body(security_contact, "SecurityContact") @@ -491,7 +499,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -596,14 +606,16 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityContact] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_contact, (IO, bytes)): + if isinstance(security_contact, (IOBase, bytes)): _content = security_contact else: _json = self._serialize.body(security_contact, "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 8387549138c9..8ef9970f0388 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +82,7 @@ def build_get_request(workspace_setting_name: str, subscription_id: str, **kwarg "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,7 +113,7 @@ def build_create_request(workspace_setting_name: str, subscription_id: str, **kw "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,7 +146,7 @@ def build_update_request(workspace_setting_name: str, subscription_id: str, **kw "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -177,7 +178,7 @@ def build_delete_request(workspace_setting_name: str, subscription_id: str, **kw "workspaceSettingName": _SERIALIZER.url("workspace_setting_name", workspace_setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -206,6 +207,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.WorkspaceSetting"]: @@ -221,7 +223,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.WorkspaceSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.WorkspaceSettingList] = kwargs.pop("cls", None) error_map = { @@ -312,7 +316,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: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) request = build_get_request( @@ -426,14 +432,16 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workspace_setting, (IO, bytes)): + if isinstance(workspace_setting, (IOBase, bytes)): _content = workspace_setting else: _json = self._serialize.body(workspace_setting, "WorkspaceSetting") @@ -552,14 +560,16 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WorkspaceSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(workspace_setting, (IO, bytes)): + if isinstance(workspace_setting, (IOBase, bytes)): _content = workspace_setting else: _json = self._serialize.body(workspace_setting, "WorkspaceSetting") @@ -625,7 +635,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2017-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py index 0aac90f41d53..a60e6c0a7add 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py @@ -52,7 +52,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize, "2018-06-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2018_06_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py index 6dceef464990..d456f9afb79b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py @@ -52,7 +52,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize, "2018-06-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 a8e7a631b4e2..81db9919e1e2 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -49,6 +50,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list(self, **kwargs: Any) -> _models.PricingList: @@ -70,7 +72,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-06-01")) cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( @@ -125,7 +127,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: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-06-01")) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( @@ -224,14 +226,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(pricing, (IO, bytes)): + if isinstance(pricing, (IOBase, bytes)): _content = pricing else: _json = self._serialize.body(pricing, "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 a064d5d5418a..7d772ad5dae9 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +79,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +109,7 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,6 +140,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> _models.PricingList: @@ -160,7 +162,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-06-01")) cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( @@ -215,7 +217,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: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-06-01")) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( @@ -314,14 +316,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2018-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(pricing, (IO, bytes)): + if isinstance(pricing, (IOBase, bytes)): _content = pricing else: _json = self._serialize.body(pricing, "Pricing") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py index 9e10b5e73cb1..23e4a7eb8d95 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py @@ -48,7 +48,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.advanced_threat_protection = AdvancedThreatProtectionOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-01-01" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2019_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py index 8317dd34122f..a94c165dc751 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py @@ -48,7 +48,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.advanced_threat_protection = AdvancedThreatProtectionOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-01-01" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 67965a676dcb..ae02b83b184c 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. # -------------------------------------------------------------------------- +from io import IOBase import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload @@ -54,6 +55,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtectionSetting: @@ -80,7 +82,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-01-01")) setting_name: Literal["current"] = kwargs.pop("setting_name", "current") cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) @@ -207,7 +209,7 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-01-01")) setting_name: Literal["current"] = kwargs.pop("setting_name", "current") content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) @@ -215,7 +217,7 @@ async def create( content_type = content_type or "application/json" _json = None _content = None - if isinstance(advanced_threat_protection_setting, (IO, bytes)): + if isinstance(advanced_threat_protection_setting, (IOBase, bytes)): _content = advanced_threat_protection_setting else: _json = self._serialize.body(advanced_threat_protection_setting, "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 11b42500dd6d..65658e4c8fa2 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. # -------------------------------------------------------------------------- +from io import IOBase import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload @@ -26,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -56,7 +57,7 @@ def build_get_request(resource_id: str, **kwargs: Any) -> HttpRequest: "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +86,7 @@ def build_create_request(resource_id: str, **kwargs: Any) -> HttpRequest: "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,6 +117,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtectionSetting: @@ -142,7 +144,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-01-01")) setting_name: Literal["current"] = kwargs.pop("setting_name", "current") cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) @@ -269,7 +271,7 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-01-01")) setting_name: Literal["current"] = kwargs.pop("setting_name", "current") content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AdvancedThreatProtectionSetting] = kwargs.pop("cls", None) @@ -277,7 +279,7 @@ def create( content_type = content_type or "application/json" _json = None _content = None - if isinstance(advanced_threat_protection_setting, (IO, bytes)): + if isinstance(advanced_threat_protection_setting, (IOBase, bytes)): _content = advanced_threat_protection_setting else: _json = self._serialize.body(advanced_threat_protection_setting, "AdvancedThreatProtectionSetting") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py index ca506ebfd9e8..203d3b7683d4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py @@ -75,18 +75,22 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.regulatory_compliance_standards = RegulatoryComplianceStandardsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" ) self.regulatory_compliance_controls = RegulatoryComplianceControlsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" ) self.regulatory_compliance_assessments = RegulatoryComplianceAssessmentsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" + ) + self.sub_assessments = SubAssessmentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" + ) + self.automations = AutomationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" ) - self.sub_assessments = SubAssessmentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.automations = AutomationsOperations(self._client, self._config, self._serialize, self._deserialize) self.alerts_suppression_rules = AlertsSuppressionRulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2019_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py index 19da659b35a0..e5d1df822219 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py @@ -76,18 +76,22 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.regulatory_compliance_standards = RegulatoryComplianceStandardsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" ) self.regulatory_compliance_controls = RegulatoryComplianceControlsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" ) self.regulatory_compliance_assessments = RegulatoryComplianceAssessmentsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" + ) + self.sub_assessments = SubAssessmentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" + ) + self.automations = AutomationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" ) - self.sub_assessments = SubAssessmentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.automations = AutomationsOperations(self._client, self._config, self._serialize, self._deserialize) self.alerts_suppression_rules = AlertsSuppressionRulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-01-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 354fa9fc9971..e8f15f2a06c8 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, alert_type: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.AlertsSuppressionRule"]: @@ -74,7 +76,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.AlertsSuppressionRulesList] = kwargs.pop("cls", None) error_map = { @@ -165,7 +169,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) request = build_get_request( @@ -284,14 +290,16 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(alerts_suppression_rule, (IO, bytes)): + if isinstance(alerts_suppression_rule, (IOBase, bytes)): _content = alerts_suppression_rule else: _json = self._serialize.body(alerts_suppression_rule, "AlertsSuppressionRule") @@ -356,7 +364,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", 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 aab4c404e7ac..9d02ddfb61d3 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Automation"]: @@ -74,7 +76,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Automation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { @@ -159,7 +163,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { @@ -255,7 +261,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.Automation] = kwargs.pop("cls", None) request = build_get_request( @@ -384,14 +392,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Automation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(automation, (IO, bytes)): + if isinstance(automation, (IOBase, bytes)): _content = automation else: _json = self._serialize.body(automation, "Automation") @@ -464,7 +474,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -589,14 +601,16 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutomationValidationStatus] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(automation, (IO, bytes)): + if isinstance(automation, (IOBase, bytes)): _content = automation else: _json = self._serialize.body(automation, "Automation") 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 1cf03b28c025..5ff2891c05d4 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -81,7 +82,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceAssessmentList] = kwargs.pop("cls", None) error_map = { @@ -189,7 +192,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceAssessment] = kwargs.pop("cls", None) 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 591b1d5a8d27..b62da0e9ec8c 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -74,7 +75,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceControlList] = kwargs.pop("cls", None) error_map = { @@ -174,7 +177,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceControl] = kwargs.pop("cls", None) 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 69db69ae0684..37aeaf3fab7a 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -71,7 +72,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceStandardList] = kwargs.pop("cls", None) error_map = { @@ -167,7 +170,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceStandard] = kwargs.pop("cls", None) 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 86b56fffb508..df47e3b664c8 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_all(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.SecuritySubAssessment"]: @@ -71,7 +72,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { @@ -159,7 +162,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { @@ -259,7 +264,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.SecuritySubAssessment] = kwargs.pop("cls", None) 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 6e82c4210bac..e883801efcf4 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_list_request(subscription_id: str, *, alert_type: Optional[str] = None ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +88,7 @@ def build_get_request(alerts_suppression_rule_name: str, subscription_id: str, * ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +121,7 @@ def build_update_request(alerts_suppression_rule_name: str, subscription_id: str ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +155,7 @@ def build_delete_request(alerts_suppression_rule_name: str, subscription_id: str ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,6 +184,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, alert_type: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AlertsSuppressionRule"]: @@ -200,7 +202,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.AlertsSuppressionRulesList] = kwargs.pop("cls", None) error_map = { @@ -291,7 +295,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) request = build_get_request( @@ -410,14 +416,16 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AlertsSuppressionRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(alerts_suppression_rule, (IO, bytes)): + if isinstance(alerts_suppression_rule, (IOBase, bytes)): _content = alerts_suppression_rule else: _json = self._serialize.body(alerts_suppression_rule, "AlertsSuppressionRule") @@ -482,7 +490,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", 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 e8b2672620ef..3f8dc2e1c754 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +119,7 @@ def build_get_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +155,7 @@ def build_create_or_update_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -191,7 +192,7 @@ def build_delete_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -227,7 +228,7 @@ def build_validate_request( "automationName": _SERIALIZER.url("automation_name", automation_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -258,6 +259,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Automation"]: @@ -273,7 +275,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Automation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { @@ -358,7 +362,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.AutomationList] = kwargs.pop("cls", None) error_map = { @@ -454,7 +460,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.Automation] = kwargs.pop("cls", None) request = build_get_request( @@ -583,14 +591,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Automation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(automation, (IO, bytes)): + if isinstance(automation, (IOBase, bytes)): _content = automation else: _json = self._serialize.body(automation, "Automation") @@ -663,7 +673,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -788,14 +800,16 @@ def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AutomationValidationStatus] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(automation, (IO, bytes)): + if isinstance(automation, (IOBase, bytes)): _content = automation else: _json = self._serialize.body(automation, "Automation") 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 d8cba4a4062e..3b021fc0b87f 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +67,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,7 +113,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,6 +142,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -171,7 +172,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceAssessmentList] = kwargs.pop("cls", None) error_map = { @@ -279,7 +282,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceAssessment] = kwargs.pop("cls", None) 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 0d23417a27fc..c7ffa10b4f8f 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +59,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,7 +101,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,6 +130,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -152,7 +153,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceControlList] = kwargs.pop("cls", None) error_map = { @@ -252,7 +255,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceControl] = kwargs.pop("cls", None) 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 1f4c98bb0d24..d945c4040d48 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +87,7 @@ def build_get_request(regulatory_compliance_standard_name: str, subscription_id: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,6 +116,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.RegulatoryComplianceStandard"]: @@ -133,7 +134,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceStandardList] = kwargs.pop("cls", None) error_map = { @@ -227,7 +230,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.RegulatoryComplianceStandard] = kwargs.pop("cls", None) 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 76f3e023f130..8ccd12ae3e78 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_all_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +76,7 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,7 +105,7 @@ def build_get_request(scope: str, assessment_name: str, sub_assessment_name: str "subAssessmentName": _SERIALIZER.url("sub_assessment_name", sub_assessment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,6 +134,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_all(self, scope: str, **kwargs: Any) -> Iterable["_models.SecuritySubAssessment"]: @@ -153,7 +154,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { @@ -241,7 +244,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.SecuritySubAssessmentList] = kwargs.pop("cls", None) error_map = { @@ -341,7 +346,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2019-01-01-preview") + ) cls: ClsType[_models.SecuritySubAssessment] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py index 0982481520ae..77bc3079f37e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py @@ -74,19 +74,19 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.device_security_groups = DeviceSecurityGroupsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) self.iot_security_solution_analytics = IotSecuritySolutionAnalyticsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) self.iot_security_solutions_analytics_aggregated_alert = IotSecuritySolutionsAnalyticsAggregatedAlertOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) self.iot_security_solutions_analytics_recommendation = IotSecuritySolutionsAnalyticsRecommendationOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) self.iot_security_solution = IotSecuritySolutionOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2019_08_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py index 5946015da3fc..2a947e21df9d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py @@ -74,19 +74,19 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.device_security_groups = DeviceSecurityGroupsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) self.iot_security_solution_analytics = IotSecuritySolutionAnalyticsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) self.iot_security_solutions_analytics_aggregated_alert = IotSecuritySolutionsAnalyticsAggregatedAlertOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) self.iot_security_solutions_analytics_recommendation = IotSecuritySolutionsAnalyticsRecommendationOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) self.iot_security_solution = IotSecuritySolutionOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2019-08-01" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 df7bfc973b84..5b49cd654a83 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, resource_id: str, **kwargs: Any) -> AsyncIterable["_models.DeviceSecurityGroup"]: @@ -73,7 +75,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DeviceSecurityGroupList] = kwargs.pop("cls", None) error_map = { @@ -168,7 +170,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) request = build_get_request( @@ -298,14 +300,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(device_security_group, (IO, bytes)): + if isinstance(device_security_group, (IOBase, bytes)): _content = device_security_group else: _json = self._serialize.body(device_security_group, "DeviceSecurityGroup") @@ -377,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", 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 f0a7bec020ac..0bb90d3d4f34 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list( @@ -77,7 +78,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] = kwargs.pop("cls", None) request = build_list_request( @@ -141,7 +142,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecuritySolutionAnalyticsModel] = kwargs.pop("cls", None) 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 6cccf016e767..56dc2031ab07 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -79,7 +81,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { @@ -172,7 +174,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { @@ -271,7 +273,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) request = build_get_request( @@ -403,14 +405,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(iot_security_solution_data, (IO, bytes)): + if isinstance(iot_security_solution_data, (IOBase, bytes)): _content = iot_security_solution_data else: _json = self._serialize.body(iot_security_solution_data, "IoTSecuritySolutionModel") @@ -554,14 +556,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(update_iot_security_solution_data, (IO, bytes)): + if isinstance(update_iot_security_solution_data, (IOBase, bytes)): _content = update_iot_security_solution_data else: _json = self._serialize.body(update_iot_security_solution_data, "UpdateIotSecuritySolutionData") @@ -630,7 +632,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", 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 4e133bf57dd4..30061f0c1812 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 @@ -56,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -80,7 +81,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecurityAggregatedAlertList] = kwargs.pop("cls", None) error_map = { @@ -183,7 +184,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecurityAggregatedAlert] = kwargs.pop("cls", None) request = build_get_request( @@ -250,7 +251,7 @@ async def dismiss( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", 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 747c3f884dbd..b3813f4437d4 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 @@ -55,6 +55,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -87,7 +88,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecurityAggregatedRecommendation] = kwargs.pop("cls", None) request = build_get_request( @@ -149,7 +150,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecurityAggregatedRecommendationList] = kwargs.pop("cls", None) error_map = { 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 eb0a0197bce3..4e8770a7c570 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_list_request(resource_id: str, **kwargs: Any) -> HttpRequest: "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +77,7 @@ def build_get_request(resource_id: str, device_security_group_name: str, **kwarg "deviceSecurityGroupName": _SERIALIZER.url("device_security_group_name", device_security_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,7 +105,7 @@ def build_create_or_update_request(resource_id: str, device_security_group_name: "deviceSecurityGroupName": _SERIALIZER.url("device_security_group_name", device_security_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +134,7 @@ def build_delete_request(resource_id: str, device_security_group_name: str, **kw "deviceSecurityGroupName": _SERIALIZER.url("device_security_group_name", device_security_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,6 +163,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, resource_id: str, **kwargs: Any) -> Iterable["_models.DeviceSecurityGroup"]: @@ -178,7 +180,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DeviceSecurityGroupList] = kwargs.pop("cls", None) error_map = { @@ -271,7 +273,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) request = build_get_request( @@ -401,14 +403,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DeviceSecurityGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(device_security_group, (IO, bytes)): + if isinstance(device_security_group, (IOBase, bytes)): _content = device_security_group else: _json = self._serialize.body(device_security_group, "DeviceSecurityGroup") @@ -480,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", 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 96e688e02cad..77c4dd2c308c 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +58,7 @@ def build_list_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -91,7 +91,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,6 +120,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -148,7 +149,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecuritySolutionAnalyticsModelList] = kwargs.pop("cls", None) request = build_list_request( @@ -212,7 +213,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecuritySolutionAnalyticsModel] = kwargs.pop("cls", None) 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 84932d448a3e..f6b6f600d945 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +56,7 @@ def build_list_by_subscription_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -91,7 +92,7 @@ def build_list_by_resource_group_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +127,7 @@ def build_get_request(resource_group_name: str, solution_name: str, subscription "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,7 +163,7 @@ def build_create_or_update_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -200,7 +201,7 @@ def build_update_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,7 +238,7 @@ def build_delete_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -266,6 +267,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription( @@ -286,7 +288,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { @@ -379,7 +381,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecuritySolutionsList] = kwargs.pop("cls", None) error_map = { @@ -476,7 +478,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: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) request = build_get_request( @@ -608,14 +610,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(iot_security_solution_data, (IO, bytes)): + if isinstance(iot_security_solution_data, (IOBase, bytes)): _content = iot_security_solution_data else: _json = self._serialize.body(iot_security_solution_data, "IoTSecuritySolutionModel") @@ -759,14 +761,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.IoTSecuritySolutionModel] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(update_iot_security_solution_data, (IO, bytes)): + if isinstance(update_iot_security_solution_data, (IOBase, bytes)): _content = update_iot_security_solution_data else: _json = self._serialize.body(update_iot_security_solution_data, "UpdateIotSecuritySolutionData") @@ -835,7 +837,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", 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 49569ea37c2b..e1f5e9246db2 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +60,7 @@ def build_list_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,7 +98,7 @@ def build_get_request( "aggregatedAlertName": _SERIALIZER.url("aggregated_alert_name", aggregated_alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,7 +134,7 @@ def build_dismiss_request( "aggregatedAlertName": _SERIALIZER.url("aggregated_alert_name", aggregated_alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,6 +163,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -187,7 +188,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecurityAggregatedAlertList] = kwargs.pop("cls", None) error_map = { @@ -290,7 +291,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecurityAggregatedAlert] = kwargs.pop("cls", None) request = build_get_request( @@ -357,7 +358,7 @@ def dismiss( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[None] = kwargs.pop("cls", 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 50840665537d..4450d45877fe 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +67,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,7 +102,7 @@ def build_list_request( "solutionName": _SERIALIZER.url("solution_name", solution_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,6 +133,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -165,7 +166,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecurityAggregatedRecommendation] = kwargs.pop("cls", None) request = build_get_request( @@ -227,7 +228,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-08-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2019-08-01")) cls: ClsType[_models.IoTSecurityAggregatedRecommendationList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py index 41a478432613..30f987fdc20a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py @@ -111,43 +111,47 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.server_vulnerability_assessment = ServerVulnerabilityAssessmentOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.assessments_metadata = AssessmentsMetadataOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" + ) + self.assessments = AssessmentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) - self.assessments = AssessmentsOperations(self._client, self._config, self._serialize, self._deserialize) self.adaptive_application_controls = AdaptiveApplicationControlsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.adaptive_network_hardenings = AdaptiveNetworkHardeningsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.allowed_connections = AllowedConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) - self.topology = TopologyOperations(self._client, self._config, self._serialize, self._deserialize) + self.topology = TopologyOperations(self._client, self._config, self._serialize, self._deserialize, "2020-01-01") self.jit_network_access_policies = JitNetworkAccessPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.discovered_security_solutions = DiscoveredSecuritySolutionsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.security_solutions_reference_data = SecuritySolutionsReferenceDataOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.external_security_solutions = ExternalSecuritySolutionsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" + ) + self.secure_scores = SecureScoresOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) - self.secure_scores = SecureScoresOperations(self._client, self._config, self._serialize, self._deserialize) self.secure_score_controls = SecureScoreControlsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.secure_score_control_definitions = SecureScoreControlDefinitionsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.security_solutions = SecuritySolutionsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2020_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py index f2b86b65f4df..6bf93a7eb23d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py @@ -111,43 +111,47 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.server_vulnerability_assessment = ServerVulnerabilityAssessmentOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.assessments_metadata = AssessmentsMetadataOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" + ) + self.assessments = AssessmentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) - self.assessments = AssessmentsOperations(self._client, self._config, self._serialize, self._deserialize) self.adaptive_application_controls = AdaptiveApplicationControlsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.adaptive_network_hardenings = AdaptiveNetworkHardeningsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.allowed_connections = AllowedConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) - self.topology = TopologyOperations(self._client, self._config, self._serialize, self._deserialize) + self.topology = TopologyOperations(self._client, self._config, self._serialize, self._deserialize, "2020-01-01") self.jit_network_access_policies = JitNetworkAccessPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.discovered_security_solutions = DiscoveredSecuritySolutionsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.security_solutions_reference_data = SecuritySolutionsReferenceDataOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.external_security_solutions = ExternalSecuritySolutionsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" + ) + self.secure_scores = SecureScoresOperations( + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) - self.secure_scores = SecureScoresOperations(self._client, self._config, self._serialize, self._deserialize) self.secure_score_controls = SecureScoreControlsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.secure_score_control_definitions = SecureScoreControlDefinitionsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) self.security_solutions = SecuritySolutionsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 0c893005cfe1..7005a2ed6b0d 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -54,6 +55,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list( @@ -81,7 +83,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AdaptiveApplicationControlGroups] = kwargs.pop("cls", None) request = build_list_request( @@ -141,7 +143,7 @@ async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) request = build_get_request( @@ -264,14 +266,14 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "AdaptiveApplicationControlGroup") @@ -340,7 +342,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( 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 a738d754b02e..c7d49a27eace 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,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. # -------------------------------------------------------------------------- +from io import IOBase import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -63,6 +64,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_extended_resource( @@ -89,7 +91,7 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AdaptiveNetworkHardeningsList] = kwargs.pop("cls", None) error_map = { @@ -203,7 +205,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AdaptiveNetworkHardening] = kwargs.pop("cls", None) request = build_get_request( @@ -267,14 +269,14 @@ async def _enforce_initial( # pylint: disable=inconsistent-return-statements adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "AdaptiveNetworkHardeningEnforceRequest") @@ -467,7 +469,7 @@ async def begin_enforce( adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) 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 106b9ee6f22f..6ad84d5199cc 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 @@ -56,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.AllowedConnectionsResource"]: @@ -71,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AllowedConnectionsResour _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { @@ -158,7 +159,7 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { @@ -265,7 +266,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AllowedConnectionsResource] = kwargs.pop("cls", None) request = build_get_request( 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 e3d360c8822c..a5a00682c814 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetadata"]: @@ -74,7 +76,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetada _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { @@ -164,7 +166,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_request( @@ -211,7 +213,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { @@ -306,7 +308,7 @@ async def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_in_subscription_request( @@ -427,14 +429,14 @@ async def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(assessment_metadata, (IO, bytes)): + if isinstance(assessment_metadata, (IOBase, bytes)): _content = assessment_metadata else: _json = self._serialize.body(assessment_metadata, "SecurityAssessmentMetadata") @@ -501,7 +503,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_in_subscription_request( 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 a673b4fe0361..a8731ec0ff84 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessment"]: @@ -75,7 +77,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { @@ -176,7 +178,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) request = build_get_request( @@ -300,14 +302,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(assessment, (IO, bytes)): + if isinstance(assessment, (IOBase, bytes)): _content = assessment else: _json = self._serialize.body(assessment, "SecurityAssessment") @@ -377,7 +379,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( 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 5c40d7e74d87..6b082f82ff07 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 @@ -56,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.DiscoveredSecuritySolution"]: @@ -71,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DiscoveredSecuritySoluti _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { @@ -158,7 +159,7 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { @@ -259,7 +260,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.DiscoveredSecuritySolution] = kwargs.pop("cls", None) request = build_get_request( 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 13f835a5e00d..6703e51b921f 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 @@ -56,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ExternalSecuritySolution"]: @@ -71,7 +72,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ExternalSecuritySolution _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { @@ -158,7 +159,7 @@ def list_by_home_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { @@ -259,7 +260,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ExternalSecuritySolution] = kwargs.pop("cls", None) request = build_get_request( 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 0386c9bd8ecd..e9de36187f50 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,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. # -------------------------------------------------------------------------- +from io import IOBase import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -66,6 +67,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.JitNetworkAccessPolicy"]: @@ -81,7 +83,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.JitNetworkAccessPolicy"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { @@ -167,7 +169,7 @@ def list_by_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable["_mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { @@ -258,7 +260,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { @@ -352,7 +354,7 @@ def list_by_resource_group_and_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { @@ -456,7 +458,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) request = build_get_request( @@ -601,14 +603,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "JitNetworkAccessPolicy") @@ -682,7 +684,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -838,14 +840,14 @@ async def initiate( jit_network_access_policy_initiate_type: Literal["initiate"] = kwargs.pop( "jit_network_access_policy_initiate_type", "initiate" ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JitNetworkAccessRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "JitNetworkAccessPolicyInitiateRequest") 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 35941e80a86f..c26123577f2e 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 @@ -54,6 +54,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreControlDefinitionItem"]: @@ -69,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreControlDefini _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { @@ -151,7 +152,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SecureSc _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { 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 b65ef6415121..71a7e2bb60f5 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 @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_secure_score( @@ -73,7 +74,7 @@ def list_by_secure_score( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { @@ -163,7 +164,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { 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 ac360aac1c88..fa072107ccd8 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreItem"]: @@ -67,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecureScoreItem"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoresList] = kwargs.pop("cls", None) error_map = { @@ -159,7 +160,7 @@ async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScor _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoreItem] = kwargs.pop("cls", None) request = build_get_request( 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 fe48cc1fe819..0ba42bd86ff2 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.SecuritySolution"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecuritySolutionList] = kwargs.pop("cls", None) error_map = { @@ -164,7 +165,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecuritySolution] = kwargs.pop("cls", None) request = build_get_request( 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 d00599027088..84e1b45a3206 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: @@ -73,7 +74,7 @@ async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataLis _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_request( @@ -131,7 +132,7 @@ async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_by_home_region_request( 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 3c45c2f1f8aa..c17ed397796d 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 @@ -61,6 +61,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list_by_extended_resource( @@ -93,7 +94,7 @@ async def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ServerVulnerabilityAssessmentsList] = kwargs.pop("cls", None) request = build_list_by_extended_resource_request( @@ -168,7 +169,7 @@ async def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_get_request( @@ -245,7 +246,7 @@ async def create_or_update( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_create_or_update_request( @@ -300,7 +301,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -371,7 +372,7 @@ async def begin_delete( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) 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 b55ba2f85e0f..0ec0d1a6238c 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 @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.TopologyResource"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.TopologyResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { @@ -150,7 +151,7 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> AsyncIterable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { @@ -251,7 +252,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.TopologyResource] = kwargs.pop("cls", None) request = build_get_request( 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 a9ccdc63be3d..3931e141c886 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +58,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,7 +95,7 @@ def build_get_request(asc_location: str, group_name: str, subscription_id: str, "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +127,7 @@ def build_put_request(asc_location: str, group_name: str, subscription_id: str, "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +160,7 @@ def build_delete_request(asc_location: str, group_name: str, subscription_id: st "groupName": _SERIALIZER.url("group_name", group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,6 +189,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -215,7 +217,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AdaptiveApplicationControlGroups] = kwargs.pop("cls", None) request = build_list_request( @@ -275,7 +277,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) request = build_get_request( @@ -398,14 +400,14 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "AdaptiveApplicationControlGroup") @@ -474,7 +476,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", 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 43c3b47b2057..48dd7c718856 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,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. # -------------------------------------------------------------------------- +from io import IOBase import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,7 +31,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -74,7 +75,7 @@ def build_list_by_extended_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +121,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +174,7 @@ def build_enforce_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -204,6 +205,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_extended_resource( @@ -230,7 +232,7 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AdaptiveNetworkHardeningsList] = kwargs.pop("cls", None) error_map = { @@ -344,7 +346,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AdaptiveNetworkHardening] = kwargs.pop("cls", None) request = build_get_request( @@ -408,14 +410,14 @@ def _enforce_initial( # pylint: disable=inconsistent-return-statements adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "AdaptiveNetworkHardeningEnforceRequest") @@ -608,7 +610,7 @@ def begin_enforce( adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( "adaptive_network_hardening_enforce_action", "enforce" ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) 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 e80d0643446d..693db100e653 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +81,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -121,7 +121,7 @@ def build_get_request( "connectionType": _SERIALIZER.url("connection_type", connection_type, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -150,6 +150,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.AllowedConnectionsResource"]: @@ -165,7 +166,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.AllowedConnectionsResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { @@ -250,7 +251,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AllowedConnectionsList] = kwargs.pop("cls", None) error_map = { @@ -357,7 +358,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.AllowedConnectionsResource] = kwargs.pop("cls", None) 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 b2cad32e0228..d5ce76282167 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +69,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque "assessmentMetadataName": _SERIALIZER.url("assessment_metadata_name", assessment_metadata_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,7 +95,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +127,7 @@ def build_get_in_subscription_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +160,7 @@ def build_create_in_subscription_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -193,7 +194,7 @@ def build_delete_in_subscription_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,6 +223,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadata"]: @@ -237,7 +239,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadata"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { @@ -327,7 +329,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_request( @@ -374,7 +376,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessmentMetadataList] = kwargs.pop("cls", None) error_map = { @@ -467,7 +469,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) request = build_get_in_subscription_request( @@ -588,14 +590,14 @@ def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityAssessmentMetadata] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(assessment_metadata, (IO, bytes)): + if isinstance(assessment_metadata, (IOBase, bytes)): _content = assessment_metadata else: _json = self._serialize.body(assessment_metadata, "SecurityAssessmentMetadata") @@ -662,7 +664,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", 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 306cc0337040..1cdbfda01b54 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +77,7 @@ def build_get_request( "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,7 +105,7 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +132,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,6 +161,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> Iterable["_models.SecurityAssessment"]: @@ -178,7 +180,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { @@ -279,7 +281,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) request = build_get_request( @@ -403,14 +405,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityAssessment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(assessment, (IO, bytes)): + if isinstance(assessment, (IOBase, bytes)): _content = assessment else: _json = self._serialize.body(assessment, "SecurityAssessment") @@ -480,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", 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 924a93438a11..20e737947be8 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,7 +125,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,6 +154,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.DiscoveredSecuritySolution"]: @@ -169,7 +170,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DiscoveredSecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { @@ -254,7 +255,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.DiscoveredSecuritySolutionList] = kwargs.pop("cls", None) error_map = { @@ -355,7 +356,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.DiscoveredSecuritySolution] = kwargs.pop("cls", None) 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 06d8f746b57c..1f1490a551e1 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +83,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,7 +125,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,6 +154,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ExternalSecuritySolution"]: @@ -169,7 +170,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ExternalSecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { @@ -254,7 +255,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ExternalSecuritySolutionList] = kwargs.pop("cls", None) error_map = { @@ -355,7 +356,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ExternalSecuritySolution] = kwargs.pop("cls", None) 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 bcf3c5da7047..f9f1fe5d728f 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,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. # -------------------------------------------------------------------------- +from io import IOBase import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,7 +29,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -58,7 +59,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +89,7 @@ def build_list_by_region_request(asc_location: str, subscription_id: str, **kwar "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +121,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -155,7 +156,7 @@ def build_list_by_resource_group_and_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -197,7 +198,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -240,7 +241,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -284,7 +285,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -333,7 +334,7 @@ def build_initiate_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -364,6 +365,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.JitNetworkAccessPolicy"]: @@ -379,7 +381,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.JitNetworkAccessPolicy"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { @@ -465,7 +467,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { @@ -556,7 +558,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { @@ -650,7 +652,7 @@ def list_by_resource_group_and_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.JitNetworkAccessPoliciesList] = kwargs.pop("cls", None) error_map = { @@ -754,7 +756,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) request = build_get_request( @@ -899,14 +901,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JitNetworkAccessPolicy] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "JitNetworkAccessPolicy") @@ -980,7 +982,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -1136,14 +1138,14 @@ def initiate( jit_network_access_policy_initiate_type: Literal["initiate"] = kwargs.pop( "jit_network_access_policy_initiate_type", "initiate" ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.JitNetworkAccessRequest] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: _json = self._serialize.body(body, "JitNetworkAccessPolicyInitiateRequest") 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 a71e28ae3369..4cfb91541f45 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +72,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,6 +101,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.SecureScoreControlDefinitionItem"]: @@ -116,7 +117,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecureScoreControlDefinitionI _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { @@ -198,7 +199,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoreControlDefinitionList] = kwargs.pop("cls", None) error_map = { 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 cd4e410b809e..27d39df5e03d 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -61,7 +61,7 @@ def build_list_by_secure_score_request( "secureScoreName": _SERIALIZER.url("secure_score_name", secure_score_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,7 +93,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,6 +124,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_secure_score( @@ -146,7 +147,7 @@ def list_by_secure_score( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { @@ -236,7 +237,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoreControlList] = kwargs.pop("cls", None) error_map = { 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 086f693eb890..31685cdff01a 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +80,7 @@ def build_get_request(secure_score_name: str, subscription_id: str, **kwargs: An "secureScoreName": _SERIALIZER.url("secure_score_name", secure_score_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,6 +109,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.SecureScoreItem"]: @@ -123,7 +124,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecureScoreItem"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoresList] = kwargs.pop("cls", None) error_map = { @@ -215,7 +216,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecureScoreItem] = kwargs.pop("cls", None) 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 597fd7e3a763..bd172567efa5 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,7 +87,7 @@ def build_get_request( "securitySolutionName": _SERIALIZER.url("security_solution_name", security_solution_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,6 +116,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.SecuritySolution"]: @@ -129,7 +130,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecuritySolution"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecuritySolutionList] = kwargs.pop("cls", None) error_map = { @@ -227,7 +228,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecuritySolution] = kwargs.pop("cls", None) 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 5f006c66799c..cd3253dcc51e 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +81,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,6 +110,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: @@ -131,7 +132,7 @@ def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) request = build_list_request( @@ -189,7 +190,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.SecuritySolutionsReferenceDataList] = kwargs.pop("cls", None) 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 dfe4efc03713..99288deca58c 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 @@ -28,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -72,7 +72,7 @@ def build_list_by_extended_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +118,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +164,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,7 +210,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -239,6 +239,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_extended_resource( @@ -271,7 +272,7 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ServerVulnerabilityAssessmentsList] = kwargs.pop("cls", None) request = build_list_by_extended_resource_request( @@ -346,7 +347,7 @@ def get( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_get_request( @@ -423,7 +424,7 @@ def create_or_update( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.ServerVulnerabilityAssessment] = kwargs.pop("cls", None) request = build_create_or_update_request( @@ -478,7 +479,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -549,7 +550,7 @@ def begin_delete( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) 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 1c554e6f5a4e..440b0ea85186 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +81,7 @@ def build_list_by_home_region_request(asc_location: str, subscription_id: str, * "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,7 +117,7 @@ def build_get_request( "topologyResourceName": _SERIALIZER.url("topology_resource_name", topology_resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -146,6 +146,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.TopologyResource"]: @@ -159,7 +160,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.TopologyResource"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { @@ -242,7 +243,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.TopologyList] = kwargs.pop("cls", None) error_map = { @@ -343,7 +344,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) cls: ClsType[_models.TopologyResource] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py index 37ebc0e8f327..43cb3e6eaa79 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py @@ -52,7 +52,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, "2020-01-01-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2020_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" 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 47854abe0a1f..70abb589779d 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 @@ -53,7 +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, "2020-01-01-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 66cb59276b43..408a35505d9b 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.ConnectorSetting"]: @@ -71,7 +73,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ConnectorSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-01-01-preview") + ) cls: ClsType[_models.ConnectorSettingList] = kwargs.pop("cls", None) error_map = { @@ -161,7 +165,9 @@ async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSett _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-01-01-preview") + ) cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) request = build_get_request( @@ -274,14 +280,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(connector_setting, (IO, bytes)): + if isinstance(connector_setting, (IOBase, bytes)): _content = connector_setting else: _json = self._serialize.body(connector_setting, "ConnectorSetting") @@ -346,7 +354,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( 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 5e0b4a07df98..8d84b416ce2d 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +81,7 @@ def build_get_request(connector_name: str, subscription_id: str, **kwargs: Any) "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +111,7 @@ def build_create_or_update_request(connector_name: str, subscription_id: str, ** "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -141,7 +142,7 @@ def build_delete_request(connector_name: str, subscription_id: str, **kwargs: An "connectorName": _SERIALIZER.url("connector_name", connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,6 +171,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.ConnectorSetting"]: @@ -184,7 +186,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.ConnectorSetting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-01-01-preview") + ) cls: ClsType[_models.ConnectorSettingList] = kwargs.pop("cls", None) error_map = { @@ -274,7 +278,9 @@ def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-01-01-preview") + ) cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) request = build_get_request( @@ -387,14 +393,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ConnectorSetting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(connector_setting, (IO, bytes)): + if isinstance(connector_setting, (IOBase, bytes)): _content = connector_setting else: _json = self._serialize.body(connector_setting, "ConnectorSetting") @@ -457,7 +465,9 @@ def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py index 9f6225154e67..68cfa262b59c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py @@ -60,13 +60,13 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.sql_vulnerability_assessment_scans = SqlVulnerabilityAssessmentScansOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-07-01-preview" ) self.sql_vulnerability_assessment_scan_results = SqlVulnerabilityAssessmentScanResultsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-07-01-preview" ) self.sql_vulnerability_assessment_baseline_rules = SqlVulnerabilityAssessmentBaselineRulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-07-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2020_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py index b59faaee9dad..416e83bd09b2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py @@ -60,13 +60,13 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.sql_vulnerability_assessment_scans = SqlVulnerabilityAssessmentScansOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-07-01-preview" ) self.sql_vulnerability_assessment_scan_results = SqlVulnerabilityAssessmentScanResultsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-07-01-preview" ) self.sql_vulnerability_assessment_baseline_rules = SqlVulnerabilityAssessmentBaselineRulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2020-07-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 1db2c9c89b9c..4f52169a2a51 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -55,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload async def create_or_update( @@ -161,14 +163,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -241,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) request = build_get_request( @@ -308,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -367,7 +375,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) request = build_list_request( @@ -499,14 +509,16 @@ async def add( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: 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 667becc45360..cbc35a2e4876 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -83,7 +84,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.ScanResult] = kwargs.pop("cls", None) request = build_get_request( @@ -150,7 +153,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.ScanResults] = kwargs.pop("cls", None) 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 16a64e40c567..f5e9772fd02d 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Scan: @@ -79,7 +80,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.Scan] = kwargs.pop("cls", None) request = build_get_request( @@ -142,7 +145,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.Scans] = kwargs.pop("cls", None) 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 f739e23204a9..2dbe14e24f6d 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +53,7 @@ def build_create_or_update_request(rule_id: str, resource_id: str, *, workspace_ "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -83,7 +84,7 @@ def build_get_request(rule_id: str, resource_id: str, *, workspace_id: str, **kw "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -112,7 +113,7 @@ def build_delete_request(rule_id: str, resource_id: str, *, workspace_id: str, * "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -139,7 +140,7 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -167,7 +168,7 @@ def build_add_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -199,6 +200,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def create_or_update( @@ -305,14 +307,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -385,7 +389,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) request = build_get_request( @@ -452,7 +458,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -511,7 +519,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) request = build_list_request( @@ -643,14 +653,16 @@ def add( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: 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 84c89fcdc9ed..0303dab17f86 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_get_request( "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -83,7 +83,7 @@ def build_list_request(scan_id: str, resource_id: str, *, workspace_id: str, **k "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -113,6 +113,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -147,7 +148,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.ScanResult] = kwargs.pop("cls", None) request = build_get_request( @@ -214,7 +217,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.ScanResults] = kwargs.pop("cls", None) 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 349437506b57..42c7e607ab8e 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_get_request(scan_id: str, resource_id: str, *, workspace_id: str, **kw "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -77,7 +77,7 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -107,6 +107,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Scan: @@ -137,7 +138,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.Scan] = kwargs.pop("cls", None) request = build_get_request( @@ -200,7 +203,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: str = kwargs.pop("api_version", _params.pop("api-version", "2020-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2020-07-01-preview") + ) cls: ClsType[_models.Scans] = kwargs.pop("cls", None) request = build_list_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py index 2a0107428ab7..377858b32833 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-01-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2021_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py index 8ebe160cdf4f..feb2f0faa41b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2021-01-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 e39d5f37ae0e..acdf741c8d34 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -68,6 +69,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -81,7 +83,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -164,7 +166,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -251,7 +253,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -343,7 +345,7 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -440,7 +442,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( @@ -507,7 +509,7 @@ async def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( @@ -572,7 +574,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( @@ -632,7 +634,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( @@ -692,7 +694,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( @@ -755,7 +757,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( @@ -819,7 +821,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( @@ -883,7 +885,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( @@ -934,14 +936,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(alert_simulator_request_body, (IO, bytes)): + if isinstance(alert_simulator_request_body, (IOBase, bytes)): _content = alert_simulator_request_body else: _json = self._serialize.body(alert_simulator_request_body, "AlertSimulatorRequestBody") @@ -1077,7 +1079,7 @@ async def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) 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 f12a1ef841c6..d1a43ef59ceb 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +86,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +117,7 @@ def build_list_subscription_level_by_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +152,7 @@ def build_list_resource_group_level_by_region_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +185,7 @@ def build_get_subscription_level_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,7 +221,7 @@ def build_get_resource_group_level_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -253,7 +254,7 @@ def build_update_subscription_level_state_to_dismiss_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -286,7 +287,7 @@ def build_update_subscription_level_state_to_resolve_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -319,7 +320,7 @@ def build_update_subscription_level_state_to_activate_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -355,7 +356,7 @@ def build_update_resource_group_level_state_to_resolve_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -391,7 +392,7 @@ def build_update_resource_group_level_state_to_dismiss_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -427,7 +428,7 @@ def build_update_resource_group_level_state_to_activate_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -458,7 +459,7 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -489,6 +490,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -502,7 +504,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -585,7 +587,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -672,7 +674,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -764,7 +766,7 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -861,7 +863,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( @@ -928,7 +930,7 @@ def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( @@ -993,7 +995,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( @@ -1053,7 +1055,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( @@ -1113,7 +1115,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( @@ -1176,7 +1178,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( @@ -1240,7 +1242,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( @@ -1304,7 +1306,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( @@ -1355,14 +1357,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(alert_simulator_request_body, (IO, bytes)): + if isinstance(alert_simulator_request_body, (IOBase, bytes)): _content = alert_simulator_request_body else: _json = self._serialize.body(alert_simulator_request_body, "AlertSimulatorRequestBody") @@ -1498,7 +1500,7 @@ def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) 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 deleted file mode 100644 index e95a015ca6b8..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._security_center import SecurityCenter -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "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 deleted file mode 100644 index 489cf11ee94e..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class 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 "2021-01-15-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: str = kwargs.pop("api_version", "2021-01-15-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.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/v2021_01_15_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json deleted file mode 100644 index f6245c812961..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_metadata.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "chosen_version": "2021-01-15-preview", - "total_api_version_list": ["2021-01-15-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, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Azure subscription ID. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "Azure subscription ID. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"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": { - "ingestion_settings": "IngestionSettingsOperations" - } -} diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py deleted file mode 100644 index b3b58422bcf3..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_security_center.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import SecurityCenterConfiguration -from .operations import IngestionSettingsOperations - -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 ingestion_settings: IngestionSettingsOperations operations - :vartype ingestion_settings: - azure.mgmt.security.v2021_01_15_preview.operations.IngestionSettingsOperations - :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 "2021-01-15-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 = 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.ingestion_settings = IngestionSettingsOperations( - 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) -> None: - self._client.close() - - def __enter__(self) -> "SecurityCenter": - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py deleted file mode 100644 index bd0df84f5319..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_vendor.py +++ /dev/null @@ -1,30 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import List, cast - -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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2021_01_15_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py deleted file mode 100644 index 34ea7990c4b4..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "5.0.0" 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 deleted file mode 100644 index d9a53c22b3e6..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._security_center import SecurityCenter - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "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 deleted file mode 100644 index 582cd67d1264..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_configuration.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class 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 "2021-01-15-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: str = kwargs.pop("api_version", "2021-01-15-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/v2021_01_15_preview/aio/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py deleted file mode 100644 index ffce83283fa7..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/_security_center.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import SecurityCenterConfiguration -from .operations import IngestionSettingsOperations - -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 ingestion_settings: IngestionSettingsOperations operations - :vartype ingestion_settings: - azure.mgmt.security.v2021_01_15_preview.aio.operations.IngestionSettingsOperations - :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 "2021-01-15-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 = 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.ingestion_settings = IngestionSettingsOperations( - 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: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py deleted file mode 100644 index e0aa0c4329cb..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._ingestion_settings_operations import IngestionSettingsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "IngestionSettingsOperations", -] -__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/operations/_ingestion_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py deleted file mode 100644 index 099b551f9e98..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_ingestion_settings_operations.py +++ /dev/null @@ -1,504 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, 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._ingestion_settings_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_connection_strings_request, - build_list_request, - build_list_tokens_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class IngestionSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2021_01_15_preview.aio.SecurityCenter`'s - :attr:`ingestion_settings` 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.IngestionSetting"]: - """Settings for ingesting security data and logs to correlate with resources associated with the - subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IngestionSetting or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSettingList] = kwargs.pop("cls", None) - - 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) - - 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) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("IngestionSettingList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings"} - - @distributed_trace_async - async def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSetting: - """Settings for ingesting security data and logs to correlate with resources associated with the - subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) - - request = build_get_request( - ingestion_setting_name=ingestion_setting_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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("IngestionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @overload - async def create( - self, - ingestion_setting_name: str, - ingestion_setting: _models.IngestionSetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Required. - :type ingestion_setting: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :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: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - ingestion_setting_name: str, - ingestion_setting: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Required. - :type ingestion_setting: 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: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, ingestion_setting_name: str, ingestion_setting: Union[_models.IngestionSetting, IO], **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Is either a IngestionSetting type or a IO - type. Required. - :type ingestion_setting: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting 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: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(ingestion_setting, (IO, bytes)): - _content = ingestion_setting - else: - _json = self._serialize.body(ingestion_setting, "IngestionSetting") - - request = build_create_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("IngestionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, ingestion_setting_name: str, **kwargs: Any - ) -> None: - """Deletes the ingestion settings for this subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - ingestion_setting_name=ingestion_setting_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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @distributed_trace_async - async def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSettingToken: - """Returns the token that is used for correlating ingested telemetry with the resources in the - subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSettingToken or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSettingToken - :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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSettingToken] = kwargs.pop("cls", None) - - request = build_list_tokens_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_tokens.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("IngestionSettingToken", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_tokens.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens" - } - - @distributed_trace_async - async def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _models.ConnectionStrings: - """Connection strings for ingesting security scan logs and data. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionStrings or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.ConnectionStrings - :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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.ConnectionStrings] = kwargs.pop("cls", None) - - request = build_list_connection_strings_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_connection_strings.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConnectionStrings", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_connection_strings.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings" - } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py deleted file mode 100644 index 439fe0cadcea..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import CloudErrorBody -from ._models_py3 import ConnectionStrings -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import IngestionConnectionString -from ._models_py3 import IngestionSetting -from ._models_py3 import IngestionSettingList -from ._models_py3 import IngestionSettingToken -from ._models_py3 import Resource -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "CloudErrorBody", - "ConnectionStrings", - "ErrorAdditionalInfo", - "IngestionConnectionString", - "IngestionSetting", - "IngestionSettingList", - "IngestionSettingToken", - "Resource", -] -__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/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py deleted file mode 100644 index 3b276818e2d8..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_models_py3.py +++ /dev/null @@ -1,272 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import sys -from typing import Any, List, Optional, TYPE_CHECKING - -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 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.v2021_01_15_preview.models.CloudErrorBody] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.security.v2021_01_15_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ConnectionStrings(_serialization.Model): - """Connection string for ingesting security data and logs. - - All required parameters must be populated in order to send to Azure. - - :ivar value: Connection strings. Required. - :vartype value: list[~azure.mgmt.security.v2021_01_15_preview.models.IngestionConnectionString] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[IngestionConnectionString]"}, - } - - def __init__(self, *, value: List["_models.IngestionConnectionString"], **kwargs: Any) -> None: - """ - :keyword value: Connection strings. Required. - :paramtype value: - list[~azure.mgmt.security.v2021_01_15_preview.models.IngestionConnectionString] - """ - super().__init__(**kwargs) - self.value = value - - -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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class IngestionConnectionString(_serialization.Model): - """Connection string for ingesting security data and logs. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: The region where ingested logs and data resides. - :vartype location: str - :ivar value: Connection string value. - :vartype value: str - """ - - _validation = { - "location": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.location = None - self.value = None - - -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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class IngestionSetting(Resource): - """Configures how to correlate scan data and logs with resources associated with the subscription. - - 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 - :ivar properties: Ingestion setting data. - :vartype properties: JSON - """ - - _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"}, - "properties": {"key": "properties", "type": "object"}, - } - - def __init__(self, *, properties: Optional[JSON] = None, **kwargs: Any) -> None: - """ - :keyword properties: Ingestion setting data. - :paramtype properties: JSON - """ - super().__init__(**kwargs) - self.properties = properties - - -class IngestionSettingList(_serialization.Model): - """List of ingestion settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ingestion settings. - :vartype value: list[~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting] - :ivar next_link: The URI to fetch the next page. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[IngestionSetting]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class IngestionSettingToken(_serialization.Model): - """Configures how to correlate scan data and logs with resources associated with the subscription. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar token: The token is used for correlating security data and logs with the resources in the - subscription. - :vartype token: str - """ - - _validation = { - "token": {"readonly": True}, - } - - _attribute_map = { - "token": {"key": "token", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.token = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py deleted file mode 100644 index e0aa0c4329cb..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._ingestion_settings_operations import IngestionSettingsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "IngestionSettingsOperations", -] -__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/operations/_ingestion_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py deleted file mode 100644 index 904099fae7d9..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_ingestion_settings_operations.py +++ /dev/null @@ -1,680 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, 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 - -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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings") - 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: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(ingestion_setting_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", - ) # 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}$" - ), - "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request(ingestion_setting_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", - ) # 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}$" - ), - "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request(ingestion_setting_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", - ) # 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}$" - ), - "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_tokens_request(ingestion_setting_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens", - ) # 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}$" - ), - "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_connection_strings_request( - ingestion_setting_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings", - ) # 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}$" - ), - "ingestionSettingName": _SERIALIZER.url("ingestion_setting_name", ingestion_setting_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class IngestionSettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2021_01_15_preview.SecurityCenter`'s - :attr:`ingestion_settings` 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.IngestionSetting"]: - """Settings for ingesting security data and logs to correlate with resources associated with the - subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IngestionSetting or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSettingList] = kwargs.pop("cls", None) - - 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) - - 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) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("IngestionSettingList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings"} - - @distributed_trace - def get(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSetting: - """Settings for ingesting security data and logs to correlate with resources associated with the - subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) - - request = build_get_request( - ingestion_setting_name=ingestion_setting_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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("IngestionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @overload - def create( - self, - ingestion_setting_name: str, - ingestion_setting: _models.IngestionSetting, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Required. - :type ingestion_setting: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :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: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - ingestion_setting_name: str, - ingestion_setting: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Required. - :type ingestion_setting: 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: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, ingestion_setting_name: str, ingestion_setting: Union[_models.IngestionSetting, IO], **kwargs: Any - ) -> _models.IngestionSetting: - """Create setting for ingesting security data and logs to correlate with resources associated with - the subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :param ingestion_setting: Ingestion setting object. Is either a IngestionSetting type or a IO - type. Required. - :type ingestion_setting: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting 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: IngestionSetting or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSetting - :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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.IngestionSetting] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(ingestion_setting, (IO, bytes)): - _content = ingestion_setting - else: - _json = self._serialize.body(ingestion_setting, "IngestionSetting") - - request = build_create_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("IngestionSetting", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, ingestion_setting_name: str, **kwargs: Any - ) -> None: - """Deletes the ingestion settings for this subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - ingestion_setting_name=ingestion_setting_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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}" - } - - @distributed_trace - def list_tokens(self, ingestion_setting_name: str, **kwargs: Any) -> _models.IngestionSettingToken: - """Returns the token that is used for correlating ingested telemetry with the resources in the - subscription. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: IngestionSettingToken or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.IngestionSettingToken - :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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.IngestionSettingToken] = kwargs.pop("cls", None) - - request = build_list_tokens_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_tokens.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("IngestionSettingToken", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_tokens.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens" - } - - @distributed_trace - def list_connection_strings(self, ingestion_setting_name: str, **kwargs: Any) -> _models.ConnectionStrings: - """Connection strings for ingesting security scan logs and data. - - :param ingestion_setting_name: Name of the ingestion setting. Required. - :type ingestion_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConnectionStrings or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_01_15_preview.models.ConnectionStrings - :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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-01-15-preview")) - cls: ClsType[_models.ConnectionStrings] = kwargs.pop("cls", None) - - request = build_list_connection_strings_request( - ingestion_setting_name=ingestion_setting_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_connection_strings.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConnectionStrings", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_connection_strings.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings" - } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_patch.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/py.typed b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_15_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py index 27780ae9c76c..f0f08b4573ee 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.software_inventories = SoftwareInventoriesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-05-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2021_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py index a0b8ce433c53..94742b63f8cd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.software_inventories = SoftwareInventoriesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-05-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 55d9059512fc..addcebdab504 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 @@ -56,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_extended_resource( @@ -81,7 +82,9 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview") + ) cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { @@ -168,7 +171,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview") + ) cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { @@ -277,7 +282,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview") + ) cls: ClsType[_models.Software] = kwargs.pop("cls", None) 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 1e3401d56c93..9383e076aaf7 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -67,7 +67,7 @@ def build_list_by_extended_resource_request( "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,7 +95,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +139,7 @@ def build_get_request( "softwareName": _SERIALIZER.url("software_name", software_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,6 +168,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_extended_resource( @@ -192,7 +193,9 @@ def list_by_extended_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview") + ) cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { @@ -278,7 +281,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview") + ) cls: ClsType[_models.SoftwaresList] = kwargs.pop("cls", None) error_map = { @@ -387,7 +392,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-05-01-preview") + ) cls: ClsType[_models.Software] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py index 472f73f3bfb2..b8bcb4717fd8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py @@ -57,11 +57,13 @@ 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, "2021-06-01") self.assessments_metadata = AssessmentsMetadataOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-06-01" + ) + self.assessments = AssessmentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-06-01" ) - self.assessments = AssessmentsOperations(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. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2021_06_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py index 816012d6b27b..0e59c51c1035 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py @@ -57,11 +57,13 @@ 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, "2021-06-01") self.assessments_metadata = AssessmentsMetadataOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-06-01" + ) + self.assessments = AssessmentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-06-01" ) - self.assessments = AssessmentsOperations(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. 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 07c54f8c18bd..c4fb79913196 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetadataResponse"]: @@ -74,7 +76,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentMetada _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { @@ -164,7 +166,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_request( @@ -211,7 +213,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { @@ -306,7 +308,7 @@ async def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_in_subscription_request( @@ -428,14 +430,14 @@ async def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(assessment_metadata, (IO, bytes)): + if isinstance(assessment_metadata, (IOBase, bytes)): _content = assessment_metadata else: _json = self._serialize.body(assessment_metadata, "SecurityAssessmentMetadataResponse") @@ -502,7 +504,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[None] = kwargs.pop("cls", 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 7fa59db0461c..036a252c9f19 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.SecurityAssessmentResponse"]: @@ -76,7 +78,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { @@ -177,7 +179,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) request = build_get_request( @@ -301,14 +303,14 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(assessment, (IO, bytes)): + if isinstance(assessment, (IOBase, bytes)): _content = assessment else: _json = self._serialize.body(assessment, "SecurityAssessment") @@ -378,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[None] = kwargs.pop("cls", 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 7647a22e665c..5a5719ba1f69 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -52,6 +53,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: @@ -66,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { @@ -157,7 +159,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( @@ -271,14 +273,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(setting, (IO, bytes)): + if isinstance(setting, (IOBase, bytes)): _content = setting else: _json = self._serialize.body(setting, "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 e56ee1a87d7f..2c286d023d43 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -68,7 +69,7 @@ def build_get_request(assessment_metadata_name: str, **kwargs: Any) -> HttpReque "assessmentMetadataName": _SERIALIZER.url("assessment_metadata_name", assessment_metadata_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -94,7 +95,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +127,7 @@ def build_get_in_subscription_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,7 +160,7 @@ def build_create_in_subscription_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -193,7 +194,7 @@ def build_delete_in_subscription_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,6 +223,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadataResponse"]: @@ -237,7 +239,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityAssessmentMetadataRes _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { @@ -327,7 +329,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_request( @@ -374,7 +376,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentMetadataResponseList] = kwargs.pop("cls", None) error_map = { @@ -469,7 +471,7 @@ def get_in_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) request = build_get_in_subscription_request( @@ -591,14 +593,14 @@ def create_in_subscription( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityAssessmentMetadataResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(assessment_metadata, (IO, bytes)): + if isinstance(assessment_metadata, (IOBase, bytes)): _content = assessment_metadata else: _json = self._serialize.body(assessment_metadata, "SecurityAssessmentMetadataResponse") @@ -665,7 +667,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[None] = kwargs.pop("cls", 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 ab971d6c63bd..5f5d9629341b 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +77,7 @@ def build_get_request( "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,7 +105,7 @@ def build_create_or_update_request(resource_id: str, assessment_name: str, **kwa "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +132,7 @@ def build_delete_request(resource_id: str, assessment_name: str, **kwargs: Any) "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,6 +161,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> Iterable["_models.SecurityAssessmentResponse"]: @@ -179,7 +181,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentList] = kwargs.pop("cls", None) error_map = { @@ -280,7 +282,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) request = build_get_request( @@ -404,14 +406,14 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityAssessmentResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(assessment, (IO, bytes)): + if isinstance(assessment, (IOBase, bytes)): _content = assessment else: _json = self._serialize.body(assessment, "SecurityAssessment") @@ -481,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[None] = kwargs.pop("cls", 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 7daa51ca5a64..37cd35997a51 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +81,7 @@ def build_get_request(setting_name: Union[str, _models.Enum1], subscription_id: "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +111,7 @@ def build_update_request(setting_name: Union[str, _models.Enum1], subscription_i "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -141,6 +142,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: @@ -154,7 +156,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { @@ -245,7 +247,7 @@ def get(self, setting_name: Union[str, _models.Enum1], **kwargs: Any) -> _models _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( @@ -359,14 +361,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(setting, (IO, bytes)): + if isinstance(setting, (IOBase, bytes)): _content = setting else: _json = self._serialize.body(setting, "Setting") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py index d75ba09255ac..fe978e6cfebc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py @@ -52,7 +52,7 @@ 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, "2021-07-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2021_07_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" 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 0d23488186e4..6718d6473cf0 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 @@ -52,7 +52,7 @@ 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, "2021-07-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 2766b2a31f5b..8f904625584c 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -52,6 +53,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: @@ -66,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-07-01")) cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { @@ -157,7 +159,7 @@ async 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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-07-01")) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( @@ -271,14 +273,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(setting, (IO, bytes)): + if isinstance(setting, (IOBase, bytes)): _content = setting else: _json = self._serialize.body(setting, "Setting") 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 61ab019a4e4d..94ead7adbcd0 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +83,7 @@ def build_get_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +115,7 @@ def build_update_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,6 +146,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: @@ -158,7 +160,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-07-01")) cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { @@ -249,7 +251,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-07-01")) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( @@ -363,14 +365,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-07-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(setting, (IO, bytes)): + if isinstance(setting, (IOBase, bytes)): _content = setting else: _json = self._serialize.body(setting, "Setting") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py index 076ae5f77234..e28084e957a8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py @@ -64,13 +64,13 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.custom_assessment_automations = CustomAssessmentAutomationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" ) self.custom_entity_store_assignments = CustomEntityStoreAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" ) self.security_connectors = SecurityConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2021_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py index 1f187e2beb83..8383f74a9846 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py @@ -64,13 +64,13 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.custom_assessment_automations = CustomAssessmentAutomationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" ) self.custom_entity_store_assignments = CustomEntityStoreAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" ) self.security_connectors = SecurityConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 849a0aeb23ee..663bac6619d2 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -58,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -89,7 +91,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) request = build_get_request( @@ -230,14 +234,16 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_assessment_automation_body, (IO, bytes)): + if isinstance(custom_assessment_automation_body, (IOBase, bytes)): _content = custom_assessment_automation_body else: _json = self._serialize.body(custom_assessment_automation_body, "CustomAssessmentAutomationRequest") @@ -312,7 +318,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -366,7 +374,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { @@ -453,7 +463,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { 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 83a2f00dc7a7..a9bdd2823d4a 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -58,6 +59,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -90,7 +92,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) request = build_get_request( @@ -233,14 +237,16 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_entity_store_assignment_request_body, (IO, bytes)): + if isinstance(custom_entity_store_assignment_request_body, (IOBase, bytes)): _content = custom_entity_store_assignment_request_body else: _json = self._serialize.body( @@ -318,7 +324,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -372,7 +380,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { @@ -459,7 +469,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { 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 7653233043d9..2a5d6bfd2f6f 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: @@ -74,7 +76,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -161,7 +165,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -259,7 +265,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( @@ -393,14 +401,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -540,14 +550,16 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -616,7 +628,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py index 2c8cfa075004..d2ca7f2d86e8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py @@ -290,8 +290,8 @@ def __init__( self, *, compressed_query: Optional[str] = None, - supported_cloud: Optional[Union[str, "_models.SupportedCloudEnum"]] = None, - severity: Optional[Union[str, "_models.SeverityEnum"]] = None, + supported_cloud: Union[str, "_models.SupportedCloudEnum"] = "AWS", + severity: Union[str, "_models.SeverityEnum"] = "Low", display_name: Optional[str] = None, description: Optional[str] = None, remediation_description: Optional[str] = None, @@ -387,8 +387,8 @@ def __init__( self, *, compressed_query: Optional[str] = None, - supported_cloud: Optional[Union[str, "_models.SupportedCloudEnum"]] = None, - severity: Optional[Union[str, "_models.SeverityEnum"]] = None, + supported_cloud: Union[str, "_models.SupportedCloudEnum"] = "AWS", + severity: Union[str, "_models.SeverityEnum"] = "Low", display_name: Optional[str] = None, description: Optional[str] = None, remediation_description: Optional[str] = None, 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 29037afe1a80..a5496d7133c7 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +63,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +101,7 @@ def build_create_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +140,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +172,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,7 +200,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,6 +229,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -259,7 +261,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) request = build_get_request( @@ -400,14 +404,16 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_assessment_automation_body, (IO, bytes)): + if isinstance(custom_assessment_automation_body, (IOBase, bytes)): _content = custom_assessment_automation_body else: _json = self._serialize.body(custom_assessment_automation_body, "CustomAssessmentAutomationRequest") @@ -482,7 +488,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -536,7 +544,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { @@ -623,7 +633,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) error_map = { 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 938668293774..3e15d0b0ac57 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -62,7 +63,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +101,7 @@ def build_create_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +140,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,7 +172,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -199,7 +200,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,6 +229,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -260,7 +262,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) request = build_get_request( @@ -403,14 +407,16 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(custom_entity_store_assignment_request_body, (IO, bytes)): + if isinstance(custom_entity_store_assignment_request_body, (IOBase, bytes)): _content = custom_entity_store_assignment_request_body else: _json = self._serialize.body( @@ -488,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -542,7 +550,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { @@ -629,7 +639,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) error_map = { 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 7388f271da5e..b97c3759aaa6 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +119,7 @@ def build_get_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +155,7 @@ def build_create_or_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,7 +193,7 @@ def build_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,7 +230,7 @@ def build_delete_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -258,6 +259,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: @@ -273,7 +275,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -358,7 +362,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -454,7 +460,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: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( @@ -588,14 +596,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -735,14 +745,16 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -811,7 +823,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py index df96282b2831..eea491791f89 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py @@ -53,7 +53,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.mde_onboardings = MdeOnboardingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.mde_onboardings = MdeOnboardingsOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-10-01-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2021_10_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py index 4ea8dcab55f6..c0c77c0be475 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py @@ -53,7 +53,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.mde_onboardings = MdeOnboardingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.mde_onboardings = MdeOnboardingsOperations( + self._client, self._config, self._serialize, self._deserialize, "2021-10-01-preview" + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 9c9c80a643b1..627d9b829398 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 @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: @@ -70,7 +71,9 @@ async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-10-01-preview") + ) cls: ClsType[_models.MdeOnboardingDataList] = kwargs.pop("cls", None) request = build_list_request( @@ -123,7 +126,9 @@ async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-10-01-preview") + ) cls: ClsType[_models.MdeOnboardingData] = kwargs.pop("cls", None) 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 4f4b46057a3d..b009fd7d747e 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 @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -77,7 +77,7 @@ def build_get_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,6 +106,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: @@ -127,7 +128,9 @@ def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-10-01-preview") + ) cls: ClsType[_models.MdeOnboardingDataList] = kwargs.pop("cls", None) request = build_list_request( @@ -180,7 +183,9 @@ def get(self, **kwargs: Any) -> _models.MdeOnboardingData: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-10-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2021-10-01-preview") + ) cls: ClsType[_models.MdeOnboardingData] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py index 78ee9ec8b55f..7674858ed412 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-01-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py index 70afb42bffb6..9c6b0a2a41b5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize) + self.alerts = AlertsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-01-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 602b5ed5c87d..582485286fec 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -70,6 +71,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: @@ -83,7 +85,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -166,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -253,7 +255,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -345,7 +347,7 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -442,7 +444,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( @@ -509,7 +511,7 @@ async def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( @@ -574,7 +576,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( @@ -634,7 +636,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( @@ -694,7 +696,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( @@ -754,7 +756,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_in_progress_request( @@ -817,7 +819,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( @@ -881,7 +883,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( @@ -945,7 +947,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( @@ -1009,7 +1011,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_in_progress_request( @@ -1060,14 +1062,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(alert_simulator_request_body, (IO, bytes)): + if isinstance(alert_simulator_request_body, (IOBase, bytes)): _content = alert_simulator_request_body else: _json = self._serialize.body(alert_simulator_request_body, "AlertSimulatorRequestBody") @@ -1203,7 +1205,7 @@ async def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) 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 a9003d2e03bd..6c177aabf93d 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +54,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,7 +86,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +117,7 @@ def build_list_subscription_level_by_region_request( "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +152,7 @@ def build_list_resource_group_level_by_region_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +185,7 @@ def build_get_subscription_level_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,7 +221,7 @@ def build_get_resource_group_level_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -253,7 +254,7 @@ def build_update_subscription_level_state_to_dismiss_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -286,7 +287,7 @@ def build_update_subscription_level_state_to_resolve_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -319,7 +320,7 @@ def build_update_subscription_level_state_to_activate_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -352,7 +353,7 @@ def build_update_subscription_level_state_to_in_progress_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -388,7 +389,7 @@ def build_update_resource_group_level_state_to_resolve_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -424,7 +425,7 @@ def build_update_resource_group_level_state_to_dismiss_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -460,7 +461,7 @@ def build_update_resource_group_level_state_to_activate_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -496,7 +497,7 @@ def build_update_resource_group_level_state_to_in_progress_request( "alertName": _SERIALIZER.url("alert_name", alert_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -527,7 +528,7 @@ def build_simulate_request(asc_location: str, subscription_id: str, **kwargs: An "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -558,6 +559,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: @@ -571,7 +573,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Alert"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -654,7 +656,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -741,7 +743,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -833,7 +835,7 @@ def list_resource_group_level_by_region( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.AlertList] = kwargs.pop("cls", None) error_map = { @@ -930,7 +932,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_subscription_level_request( @@ -997,7 +999,7 @@ def get_resource_group_level( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[_models.Alert] = kwargs.pop("cls", None) request = build_get_resource_group_level_request( @@ -1062,7 +1064,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_dismiss_request( @@ -1122,7 +1124,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_resolve_request( @@ -1182,7 +1184,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_activate_request( @@ -1242,7 +1244,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_subscription_level_state_to_in_progress_request( @@ -1305,7 +1307,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_resolve_request( @@ -1369,7 +1371,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_dismiss_request( @@ -1433,7 +1435,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_activate_request( @@ -1497,7 +1499,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) cls: ClsType[None] = kwargs.pop("cls", None) request = build_update_resource_group_level_state_to_in_progress_request( @@ -1548,14 +1550,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(alert_simulator_request_body, (IO, bytes)): + if isinstance(alert_simulator_request_body, (IOBase, bytes)): _content = alert_simulator_request_body else: _json = self._serialize.body(alert_simulator_request_body, "AlertSimulatorRequestBody") @@ -1691,7 +1693,7 @@ def begin_simulate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py index 985797ba08f1..f6eff2f7d688 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py @@ -53,10 +53,10 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.governance_rules = GovernanceRulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" ) self.governance_assignments = GovernanceAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py index 51ff6579ebd2..496fc4e974f0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py @@ -53,10 +53,10 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.governance_rules = GovernanceRulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" ) self.governance_assignments = GovernanceAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-01-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 695aed426375..96ac0553906f 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -57,6 +58,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, assessment_name: str, **kwargs: Any) -> AsyncIterable["_models.GovernanceAssignment"]: @@ -79,7 +81,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[_models.GovernanceAssignmentsList] = kwargs.pop("cls", None) error_map = { @@ -180,7 +184,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) request = build_get_request( @@ -330,14 +336,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(governance_assignment, (IO, bytes)): + if isinstance(governance_assignment, (IOBase, bytes)): _content = governance_assignment else: _json = self._serialize.body(governance_assignment, "GovernanceAssignment") @@ -415,7 +423,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( 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 b9b49f624126..6eb478f81bdf 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -61,6 +62,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.GovernanceRule"]: @@ -81,7 +83,9 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.GovernanceRu _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[_models.GovernanceRuleList] = kwargs.pop("cls", None) error_map = { @@ -178,7 +182,9 @@ async def get(self, scope: str, rule_id: str, **kwargs: Any) -> _models.Governan _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) request = build_get_request( @@ -307,14 +313,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(governance_rule, (IO, bytes)): + if isinstance(governance_rule, (IOBase, bytes)): _content = governance_rule else: _json = self._serialize.body(governance_rule, "GovernanceRule") @@ -371,7 +379,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -433,7 +443,9 @@ async def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> AsyncLR _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -491,14 +503,16 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(execute_governance_rule_params, (IO, bytes)): + if isinstance(execute_governance_rule_params, (IOBase, bytes)): _content = execute_governance_rule_params else: if execute_governance_rule_params is not None: @@ -661,7 +675,9 @@ async def begin_execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -738,7 +754,9 @@ async def operation_results( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[Optional[_models.OperationResultAutoGenerated]] = kwargs.pop("cls", None) request = build_operation_results_request( 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 e26965c74fcf..3ffee0a032c7 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +53,7 @@ def build_list_request(scope: str, assessment_name: str, **kwargs: Any) -> HttpR "assessmentName": _SERIALIZER.url("assessment_name", assessment_name, "str", pattern=r"^[-\w\._\(\)]+$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,7 +82,7 @@ def build_get_request(scope: str, assessment_name: str, assignment_key: str, **k "assignmentKey": _SERIALIZER.url("assignment_key", assignment_key, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,7 +112,7 @@ def build_create_or_update_request(scope: str, assessment_name: str, assignment_ "assignmentKey": _SERIALIZER.url("assignment_key", assignment_key, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +140,7 @@ def build_delete_request(scope: str, assessment_name: str, assignment_key: str, "assignmentKey": _SERIALIZER.url("assignment_key", assignment_key, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,6 +166,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, assessment_name: str, **kwargs: Any) -> Iterable["_models.GovernanceAssignment"]: @@ -187,7 +189,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[_models.GovernanceAssignmentsList] = kwargs.pop("cls", None) error_map = { @@ -286,7 +290,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) request = build_get_request( @@ -436,14 +442,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GovernanceAssignment] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(governance_assignment, (IO, bytes)): + if isinstance(governance_assignment, (IOBase, bytes)): _content = governance_assignment else: _json = self._serialize.body(governance_assignment, "GovernanceAssignment") @@ -521,7 +529,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( 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 3921e077fcef..317b4f554313 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -29,7 +30,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +77,7 @@ def build_get_request(scope: str, rule_id: str, **kwargs: Any) -> HttpRequest: "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,7 +103,7 @@ def build_create_or_update_request(scope: str, rule_id: str, **kwargs: Any) -> H "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +127,7 @@ def build_delete_request(scope: str, rule_id: str, **kwargs: Any) -> HttpRequest "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -149,7 +150,7 @@ def build_execute_request(scope: str, rule_id: str, **kwargs: Any) -> HttpReques "ruleId": _SERIALIZER.url("rule_id", rule_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -179,7 +180,7 @@ def build_operation_results_request(scope: str, rule_id: str, operation_id: str, "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -208,6 +209,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> Iterable["_models.GovernanceRule"]: @@ -228,7 +230,9 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.GovernanceRule"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[_models.GovernanceRuleList] = kwargs.pop("cls", None) error_map = { @@ -325,7 +329,9 @@ def get(self, scope: str, rule_id: str, **kwargs: Any) -> _models.GovernanceRule _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) request = build_get_request( @@ -454,14 +460,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.GovernanceRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(governance_rule, (IO, bytes)): + if isinstance(governance_rule, (IOBase, bytes)): _content = governance_rule else: _json = self._serialize.body(governance_rule, "GovernanceRule") @@ -518,7 +526,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -580,7 +590,9 @@ def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> LROPoller[Non _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -638,14 +650,16 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(execute_governance_rule_params, (IO, bytes)): + if isinstance(execute_governance_rule_params, (IOBase, bytes)): _content = execute_governance_rule_params else: if execute_governance_rule_params is not None: @@ -808,7 +822,9 @@ def begin_execute( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -885,7 +901,9 @@ def operation_results( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") + ) cls: ClsType[Optional[_models.OperationResultAutoGenerated]] = kwargs.pop("cls", None) request = build_operation_results_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py index def06d937af3..4083cb0402b0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py @@ -52,7 +52,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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_03_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py index 712cee16c5b3..d48089f9280a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py @@ -52,7 +52,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize, "2022-03-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 c126c362661b..3ad1b142a6e5 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -49,6 +50,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list(self, **kwargs: Any) -> _models.PricingList: @@ -70,7 +72,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( @@ -125,7 +127,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( @@ -224,14 +226,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(pricing, (IO, bytes)): + if isinstance(pricing, (IOBase, bytes)): _content = pricing else: _json = self._serialize.body(pricing, "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 2cf57a8ea298..5f0c504c1fd4 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +79,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +109,7 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,6 +140,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> _models.PricingList: @@ -160,7 +162,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( @@ -215,7 +217,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( @@ -314,14 +316,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-03-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-03-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(pricing, (IO, bytes)): + if isinstance(pricing, (IOBase, bytes)): _content = pricing else: _json = self._serialize.body(pricing, "Pricing") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py index fc68fa3ea9c2..e4082f27af75 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py @@ -52,7 +52,7 @@ 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, "2022-05-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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_05_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py index 9cef09f45fab..d2daab4df997 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py @@ -52,7 +52,7 @@ 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, "2022-05-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 a37c42204d5b..6a14c636c1ce 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -52,6 +53,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: @@ -66,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { @@ -157,7 +159,7 @@ async 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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( @@ -271,14 +273,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(setting, (IO, bytes)): + if isinstance(setting, (IOBase, bytes)): _content = setting else: _json = self._serialize.body(setting, "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 3edb98d8fe85..a5de91380e59 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +83,7 @@ def build_get_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +115,7 @@ def build_update_request( "settingName": _SERIALIZER.url("setting_name", setting_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -145,6 +146,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: @@ -158,7 +160,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Setting"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.SettingsList] = kwargs.pop("cls", None) error_map = { @@ -249,7 +251,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) request = build_get_request( @@ -363,14 +365,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Setting] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(setting, (IO, bytes)): + if isinstance(setting, (IOBase, bytes)): _content = setting else: _json = self._serialize.body(setting, "Setting") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py index 9798db8a62eb..369935e63950 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.security_connectors = SecurityConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py index 09cb6fa13cd8..a1832afc8928 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.security_connectors = SecurityConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-05-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 eb70b6199986..10753a742a8c 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: @@ -74,7 +76,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -161,7 +165,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -259,7 +265,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( @@ -393,14 +401,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -540,14 +550,16 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -616,7 +628,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( 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 0e6fe0c8fe02..7ec1341d1589 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,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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +119,7 @@ def build_get_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +155,7 @@ def build_create_or_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,7 +193,7 @@ def build_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,7 +230,7 @@ def build_delete_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -258,6 +259,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: @@ -273,7 +275,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -358,7 +362,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -454,7 +460,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( @@ -588,14 +596,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -735,14 +745,16 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -811,7 +823,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-05-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-05-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py index ea6e857630f7..42d57cb469bf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py @@ -66,13 +66,17 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.application = ApplicationOperations(self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-07-01-preview" + ) + self.application = ApplicationOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-07-01-preview" + ) self.security_connector_applications = SecurityConnectorApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-07-01-preview" ) self.security_connector_application = SecurityConnectorApplicationOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-07-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py index 34ea7990c4b4..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 = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py index 24f7a2c6a316..dc11d8583275 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py @@ -67,13 +67,17 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.application = ApplicationOperations(self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-07-01-preview" + ) + self.application = ApplicationOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-07-01-preview" + ) self.security_connector_applications = SecurityConnectorApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-07-01-preview" ) self.security_connector_application = SecurityConnectorApplicationOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-07-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 216ee48f31f9..3c9baf78b8d9 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -53,6 +54,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, application_id: str, **kwargs: Any) -> _models.Application: @@ -77,7 +79,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( @@ -187,14 +191,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(application, (IO, bytes)): + if isinstance(application, (IOBase, bytes)): _content = application else: _json = self._serialize.body(application, "Application") @@ -264,7 +270,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", 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 8b8004c9733a..b95130f09afe 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 @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Application"]: @@ -65,7 +66,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Application"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 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 aa009610b627..b7aace553aac 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -53,6 +54,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -84,7 +86,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( @@ -227,14 +231,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(application, (IO, bytes)): + if isinstance(application, (IOBase, bytes)): _content = application else: _json = self._serialize.body(application, "Application") @@ -311,7 +317,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", 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 9ea9919210de..98da9bba7c05 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 @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -72,7 +73,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 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 b98a76ec6f6f..c1193a31e2ad 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +53,7 @@ def build_get_request(application_id: str, subscription_id: str, **kwargs: Any) "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +83,7 @@ def build_create_or_update_request(application_id: str, subscription_id: str, ** "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +111,7 @@ def build_delete_request(application_id: str, subscription_id: str, **kwargs: An "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,6 +137,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, application_id: str, **kwargs: Any) -> _models.Application: @@ -160,7 +162,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( @@ -270,14 +274,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(application, (IO, bytes)): + if isinstance(application, (IOBase, bytes)): _content = application else: _json = self._serialize.body(application, "Application") @@ -345,7 +351,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", 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 2ec7d9218cac..c68dc11c4b9f 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +51,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,6 +80,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Application"]: @@ -94,7 +95,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.Application"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 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 28489e7ed320..f34fd4f0b9fd 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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +60,7 @@ def build_get_request( "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,7 +97,7 @@ def build_create_or_update_request( "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +132,7 @@ def build_delete_request( "applicationId": _SERIALIZER.url("application_id", application_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,6 +158,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -188,7 +190,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[_models.Application] = kwargs.pop("cls", None) request = build_get_request( @@ -331,14 +335,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Application] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(application, (IO, bytes)): + if isinstance(application, (IOBase, bytes)): _content = application else: _json = self._serialize.body(application, "Application") @@ -415,7 +421,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", 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 c35eb33ea56d..e0b89955d63f 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 @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -60,7 +60,7 @@ def build_list_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,6 +89,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -110,7 +111,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-07-01-preview") + ) cls: ClsType[_models.ApplicationsList] = kwargs.pop("cls", None) error_map = { 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 index d4bd92f40269..7d821368738f 100644 --- 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 @@ -54,7 +54,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.security_connectors = SecurityConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: 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 index bd0df84f5319..0dafe0e287ff 100644 --- 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 @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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 index 34ea7990c4b4..e5754a47ce68 100644 --- 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 @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "1.0.0b1" 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 index 5cf32d6522ff..bcfc40864212 100644 --- 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 @@ -54,7 +54,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.security_connectors = SecurityConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-08-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: 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 index 65ac800fbed9..33351b4668b6 100644 --- 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 @@ -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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: @@ -74,7 +76,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -161,7 +165,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -259,7 +265,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( @@ -393,14 +401,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -540,14 +550,16 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -616,7 +628,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( 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 index a7993a553a70..be61fa384e5a 100644 --- 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 @@ -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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +119,7 @@ def build_get_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +155,7 @@ def build_create_or_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,7 +193,7 @@ def build_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,7 +230,7 @@ def build_delete_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -258,6 +259,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: @@ -273,7 +275,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -358,7 +362,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -454,7 +460,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: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( @@ -588,14 +596,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -735,14 +745,16 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -811,7 +823,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-08-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-08-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_security_center.py index b2a7260da2e9..118616922018 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_security_center.py @@ -59,12 +59,14 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.api_collection = APICollectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_collection = APICollectionOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-11-20-preview" + ) self.api_collection_onboarding = APICollectionOnboardingOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-11-20-preview" ) self.api_collection_offboarding = APICollectionOffboardingOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-11-20-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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_11_20_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_version.py index 34ea7990c4b4..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/_security_center.py index 729482ac997b..be99fad4bca9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/_security_center.py @@ -59,12 +59,14 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.api_collection = APICollectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_collection = APICollectionOperations( + self._client, self._config, self._serialize, self._deserialize, "2022-11-20-preview" + ) self.api_collection_onboarding = APICollectionOnboardingOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-11-20-preview" ) self.api_collection_offboarding = APICollectionOffboardingOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2022-11-20-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_offboarding_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_offboarding_operations.py index 7901f3adf739..be671b18caf1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_offboarding_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_offboarding_operations.py @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -84,7 +85,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-20-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-11-20-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_onboarding_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_onboarding_operations.py index ef3e16f10f16..6cef03177e5a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_onboarding_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_onboarding_operations.py @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def create( @@ -85,7 +86,9 @@ async def create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-20-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-11-20-preview") + ) cls: ClsType[_models.ApiCollectionResponse] = kwargs.pop("cls", None) request = build_create_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_operations.py index 7d95afcb3ff0..5e1d46bc73cb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_operations.py @@ -52,6 +52,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -79,7 +80,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-20-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-11-20-preview") + ) cls: ClsType[_models.ApiCollectionResponseList] = kwargs.pop("cls", None) error_map = { @@ -188,7 +191,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-20-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-11-20-preview") + ) cls: ClsType[_models.ApiCollectionResponse] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_offboarding_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_offboarding_operations.py index d82962b536fe..6c4d2f9c9f83 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_offboarding_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_offboarding_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +64,7 @@ def build_delete_request( "apiCollectionId": _SERIALIZER.url("api_collection_id", api_collection_id, "str", max_length=256, min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,6 +93,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -128,7 +129,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-20-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-11-20-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_onboarding_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_onboarding_operations.py index 024feb82531d..0e36d4dcfc90 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_onboarding_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_onboarding_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +64,7 @@ def build_create_request( "apiCollectionId": _SERIALIZER.url("api_collection_id", api_collection_id, "str", max_length=256, min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,6 +93,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def create( @@ -129,7 +130,9 @@ def create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-20-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-11-20-preview") + ) cls: ClsType[_models.ApiCollectionResponse] = kwargs.pop("cls", None) request = build_create_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_operations.py index 9bc3b3c4af92..df3aea954011 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +63,7 @@ def build_list_request(resource_group_name: str, service_name: str, subscription ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -104,7 +104,7 @@ def build_get_request( "apiCollectionId": _SERIALIZER.url("api_collection_id", api_collection_id, "str", max_length=256, min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,6 +133,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list( @@ -160,7 +161,9 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-20-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-11-20-preview") + ) cls: ClsType[_models.ApiCollectionResponseList] = kwargs.pop("cls", None) error_map = { @@ -269,7 +272,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-11-20-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2022-11-20-preview") + ) cls: ClsType[_models.ApiCollectionResponse] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_security_center.py index b1fcc6238204..4a30327092ec 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_security_center.py @@ -52,7 +52,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-01-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2023_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_version.py index 34ea7990c4b4..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/_security_center.py index 01a5fef602d9..492709a1a213 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/_security_center.py @@ -52,7 +52,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.pricings = PricingsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-01-01") def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/operations/_pricings_operations.py index 180bd2169e0f..8f1142df39da 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -49,6 +50,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list(self, **kwargs: Any) -> _models.PricingList: @@ -70,7 +72,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( @@ -125,7 +127,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( @@ -224,14 +226,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(pricing, (IO, bytes)): + if isinstance(pricing, (IOBase, bytes)): _content = pricing else: _json = self._serialize.body(pricing, "Pricing") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/operations/_pricings_operations.py index 469079d1e3d1..255fa244c8c4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +79,7 @@ def build_get_request(pricing_name: str, subscription_id: str, **kwargs: Any) -> "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,7 +109,7 @@ def build_update_request(pricing_name: str, subscription_id: str, **kwargs: Any) "pricingName": _SERIALIZER.url("pricing_name", pricing_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,6 +140,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> _models.PricingList: @@ -160,7 +162,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.PricingList] = kwargs.pop("cls", None) request = build_list_request( @@ -215,7 +217,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) request = build_get_request( @@ -314,14 +316,14 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Pricing] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(pricing, (IO, bytes)): + if isinstance(pricing, (IOBase, bytes)): _content = pricing else: _json = self._serialize.body(pricing, "Pricing") diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_security_center.py index ac7601564ce0..1663c6a04734 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.security_operators = SecurityOperatorsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2023_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_version.py index 34ea7990c4b4..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/_security_center.py index c50e67d50cc7..070e9237a94e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.security_operators = SecurityOperatorsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2023-01-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/operations/_security_operators_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/operations/_security_operators_operations.py index 5e8981142f40..ad254b279884 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/operations/_security_operators_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/operations/_security_operators_operations.py @@ -54,6 +54,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def list(self, pricing_name: str, **kwargs: Any) -> _models.SecurityOperatorList: @@ -77,7 +78,9 @@ async def list(self, pricing_name: str, **kwargs: Any) -> _models.SecurityOperat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") + ) cls: ClsType[_models.SecurityOperatorList] = kwargs.pop("cls", None) request = build_list_request( @@ -137,7 +140,9 @@ async def get(self, pricing_name: str, security_operator_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") + ) cls: ClsType[_models.SecurityOperator] = kwargs.pop("cls", None) request = build_get_request( @@ -200,7 +205,9 @@ async def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") + ) cls: ClsType[_models.SecurityOperator] = kwargs.pop("cls", None) request = build_create_or_update_request( @@ -263,7 +270,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/operations/_security_operators_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/operations/_security_operators_operations.py index 88f474fb9ca6..92755345991c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/operations/_security_operators_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/operations/_security_operators_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,7 @@ def build_list_request(pricing_name: str, subscription_id: str, **kwargs: Any) - ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +97,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +139,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,7 +181,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -210,6 +210,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, pricing_name: str, **kwargs: Any) -> _models.SecurityOperatorList: @@ -233,7 +234,9 @@ def list(self, pricing_name: str, **kwargs: Any) -> _models.SecurityOperatorList _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") + ) cls: ClsType[_models.SecurityOperatorList] = kwargs.pop("cls", None) request = build_list_request( @@ -293,7 +296,9 @@ def get(self, pricing_name: str, security_operator_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") + ) cls: ClsType[_models.SecurityOperator] = kwargs.pop("cls", None) request = build_get_request( @@ -356,7 +361,9 @@ def create_or_update( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") + ) cls: ClsType[_models.SecurityOperator] = kwargs.pop("cls", None) request = build_create_or_update_request( @@ -419,7 +426,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-01-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_security_center.py index 035e3016766b..43e7a075afa3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_security_center.py @@ -68,16 +68,20 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.sql_vulnerability_assessment_baseline_rules = SqlVulnerabilityAssessmentBaselineRulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2023-02-01-preview" ) self.sql_vulnerability_assessment_scans = SqlVulnerabilityAssessmentScansOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2023-02-01-preview" ) self.sql_vulnerability_assessment_scan_results = SqlVulnerabilityAssessmentScanResultsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2023-02-01-preview" + ) + self.health_reports = HealthReportsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-02-01-preview" + ) + self.health_report = HealthReportOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-02-01-preview" ) - self.health_reports = HealthReportsOperations(self._client, self._config, self._serialize, self._deserialize) - self.health_report = HealthReportOperations(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. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2023_02_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_version.py index 34ea7990c4b4..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/_security_center.py index 55f9e3c2d844..30c549e7c024 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/_security_center.py @@ -68,16 +68,20 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.sql_vulnerability_assessment_baseline_rules = SqlVulnerabilityAssessmentBaselineRulesOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2023-02-01-preview" ) self.sql_vulnerability_assessment_scans = SqlVulnerabilityAssessmentScansOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2023-02-01-preview" ) self.sql_vulnerability_assessment_scan_results = SqlVulnerabilityAssessmentScanResultsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2023-02-01-preview" + ) + self.health_reports = HealthReportsOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-02-01-preview" + ) + self.health_report = HealthReportOperations( + self._client, self._config, self._serialize, self._deserialize, "2023-02-01-preview" ) - self.health_reports = HealthReportsOperations(self._client, self._config, self._serialize, self._deserialize) - self.health_report = HealthReportOperations(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. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_report_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_report_operations.py index 852329018d70..12acbd3fa508 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_report_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_report_operations.py @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> _models.HealthReport: @@ -75,7 +76,9 @@ async def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.HealthReport] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_reports_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_reports_operations.py index dca763a5abab..9df07c928c38 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_reports_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_reports_operations.py @@ -51,6 +51,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.HealthReport"]: @@ -69,7 +70,9 @@ def list(self, scope: str, **kwargs: Any) -> AsyncIterable["_models.HealthReport _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.HealthReportsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index 02b232640a32..308c4b7fd1d7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -55,6 +56,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload async def create_or_update( @@ -161,14 +163,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -241,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) request = build_get_request( @@ -308,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -367,7 +375,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) request = build_list_request( @@ -499,14 +509,16 @@ async def add( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py index faf8e1678563..8ced3a5352ad 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get( @@ -83,7 +84,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.ScanResult] = kwargs.pop("cls", None) request = build_get_request( @@ -150,7 +153,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.ScanResults] = kwargs.pop("cls", None) request = build_list_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py index 3adad361e900..9880755edec5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py @@ -49,6 +49,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Scan: @@ -79,7 +80,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.Scan] = kwargs.pop("cls", None) request = build_get_request( @@ -142,7 +145,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.Scans] = kwargs.pop("cls", None) request = build_list_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_report_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_report_operations.py index c8dcf4dbf55d..963d9b7c2a59 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_report_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_report_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +53,7 @@ def build_get_request(resource_id: str, health_report_name: str, **kwargs: Any) ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,6 +82,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> _models.HealthReport: @@ -108,7 +109,9 @@ def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.HealthReport] = kwargs.pop("cls", None) request = build_get_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_reports_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_reports_operations.py index f87d7219a84e..0ed9e0024d1e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_reports_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_reports_operations.py @@ -27,7 +27,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +49,7 @@ def build_list_request(scope: str, **kwargs: Any) -> HttpRequest: "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True, max_length=90, min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,6 +78,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, scope: str, **kwargs: Any) -> Iterable["_models.HealthReport"]: @@ -96,7 +97,9 @@ def list(self, scope: str, **kwargs: Any) -> Iterable["_models.HealthReport"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.HealthReportsList] = kwargs.pop("cls", None) error_map = { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index 5ed3ce4fed9b..7544d70c4208 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,7 +26,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +53,7 @@ def build_create_or_update_request(rule_id: str, resource_id: str, *, workspace_ "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -83,7 +84,7 @@ def build_get_request(rule_id: str, resource_id: str, *, workspace_id: str, **kw "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -112,7 +113,7 @@ def build_delete_request(rule_id: str, resource_id: str, *, workspace_id: str, * "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -139,7 +140,7 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -167,7 +168,7 @@ def build_add_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -199,6 +200,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload def create_or_update( @@ -305,14 +307,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -385,7 +389,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.RuleResults] = kwargs.pop("cls", None) request = build_get_request( @@ -452,7 +458,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -511,7 +519,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) request = build_list_request( @@ -643,14 +653,16 @@ def add( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.RulesResults] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py index 552d1b48ddf1..1698456df475 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +54,7 @@ def build_get_request( "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -83,7 +83,7 @@ def build_list_request(scan_id: str, resource_id: str, *, workspace_id: str, **k "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -113,6 +113,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get( @@ -147,7 +148,9 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.ScanResult] = kwargs.pop("cls", None) request = build_get_request( @@ -214,7 +217,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.ScanResults] = kwargs.pop("cls", None) request = build_list_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py index c51aca11e0e4..bc1a9e269e73 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py @@ -25,7 +25,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_get_request(scan_id: str, resource_id: str, *, workspace_id: str, **kw "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -77,7 +77,7 @@ def build_list_request(resource_id: str, *, workspace_id: str, **kwargs: Any) -> "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["workspaceId"] = _SERIALIZER.query("workspace_id", workspace_id, "str") @@ -107,6 +107,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Scan: @@ -137,7 +138,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.Scan] = kwargs.pop("cls", None) request = build_get_request( @@ -200,7 +203,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-02-01-preview") + ) cls: ClsType[_models.Scans] = kwargs.pop("cls", None) request = build_list_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_security_center.py index 6191cafe4d13..fdf5c78b6825 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.security_connectors = SecurityConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_vendor.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_vendor.py @@ -5,8 +5,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast - from azure.core.pipeline.transport import HttpRequest @@ -16,15 +14,3 @@ def _convert_request(request, files=None): 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: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], 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/v2023_03_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_version.py index 34ea7990c4b4..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/_security_center.py index 473190a468cc..a5c4f44cfecf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/_security_center.py @@ -54,7 +54,7 @@ def __init__( self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.security_connectors = SecurityConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize + self._client, self._config, self._serialize, self._deserialize, "2023-03-01-preview" ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/operations/_security_connectors_operations.py index a30183ad45ae..6e8d2a508228 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/operations/_security_connectors_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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -59,6 +60,7 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: @@ -74,7 +76,9 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -161,7 +165,9 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -259,7 +265,9 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( @@ -393,14 +401,16 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -540,14 +550,16 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -616,7 +628,9 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/operations/_security_connectors_operations.py index 616ae06d5e7f..b681b64550d3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/operations/_security_connectors_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. # -------------------------------------------------------------------------- +from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,7 +28,7 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import _convert_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +52,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,7 +84,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +119,7 @@ def build_get_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +155,7 @@ def build_create_or_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,7 +193,7 @@ def build_update_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,7 +230,7 @@ def build_delete_request( "securityConnectorName": _SERIALIZER.url("security_connector_name", security_connector_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -258,6 +259,7 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: @@ -273,7 +275,9 @@ def list(self, **kwargs: Any) -> Iterable["_models.SecurityConnector"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -358,7 +362,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) cls: ClsType[_models.SecurityConnectorsList] = kwargs.pop("cls", None) error_map = { @@ -454,7 +460,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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) request = build_get_request( @@ -588,14 +596,16 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -735,14 +745,16 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SecurityConnector] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(security_connector, (IO, bytes)): + if isinstance(security_connector, (IOBase, bytes)): _content = security_connector else: _json = self._serialize.body(security_connector, "SecurityConnector") @@ -811,7 +823,9 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01-preview")) + api_version: str = kwargs.pop( + "api_version", _params.pop("api-version", self._api_version or "2023-03-01-preview") + ) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( diff --git a/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_cloud_posture_example.py b/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_cloud_posture_example.py new file mode 100644 index 000000000000..8017397a433d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_cloud_posture_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_pricing_by_name_cloud_posture_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.pricings.get( + pricing_name="CloudPosture", + ) + print(response) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/GetPricingByNameCloudPosture_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_containers_example.py b/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_containers_example.py new file mode 100644 index 000000000000..ce6d86c97096 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_containers_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_pricing_by_name_containers_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.pricings.get( + pricing_name="Containers", + ) + print(response) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/GetPricingByNameContainers_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_dns_example.py b/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_dns_example.py new file mode 100644 index 000000000000..2e11fb0479eb --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_dns_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_pricing_by_name_dns_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.pricings.get( + pricing_name="Dns", + ) + print(response) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/GetPricingByNameDns_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_storage_accounts_example.py b/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_storage_accounts_example.py new file mode 100644 index 000000000000..270278401b8c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_storage_accounts_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_pricing_by_name_storage_accounts_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.pricings.get( + pricing_name="StorageAccounts", + ) + print(response) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/GetPricingByNameStorageAccounts_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_virtual_machines_example.py b/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_virtual_machines_example.py new file mode 100644 index 000000000000..8e2dfa237042 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/pricings/get_pricing_by_name_virtual_machines_example.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python get_pricing_by_name_virtual_machines_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.pricings.get( + pricing_name="VirtualMachines", + ) + print(response) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/GetPricingByNameVirtualMachines_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/pricings/list_pricings_example.py b/sdk/security/azure-mgmt-security/generated_samples/pricings/list_pricings_example.py new file mode 100644 index 000000000000..dd7a40416371 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/pricings/list_pricings_example.py @@ -0,0 +1,38 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python list_pricings_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.pricings.list() + print(response) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/ListPricings_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/pricings/put_pricing_by_name_example.py b/sdk/security/azure-mgmt-security/generated_samples/pricings/put_pricing_by_name_example.py new file mode 100644 index 000000000000..031f255e6107 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/pricings/put_pricing_by_name_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_pricing_by_name_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.pricings.update( + pricing_name="CloudPosture", + pricing={"properties": {"pricingTier": "Standard"}}, + ) + print(response) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/PutPricingByName_example.json +if __name__ == "__main__": + main() diff --git a/sdk/security/azure-mgmt-security/generated_samples/pricings/put_pricing_by_name_partial_success_example.py b/sdk/security/azure-mgmt-security/generated_samples/pricings/put_pricing_by_name_partial_success_example.py new file mode 100644 index 000000000000..add40d31d217 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_samples/pricings/put_pricing_by_name_partial_success_example.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.security import SecurityCenter + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-security +# USAGE + python put_pricing_by_name_partial_success_example.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SecurityCenter( + credential=DefaultAzureCredential(), + subscription_id="20ff7fc3-e762-44dd-bd96-b71116dcdc23", + ) + + response = client.pricings.update( + pricing_name="CloudPosture", + pricing={"properties": {"pricingTier": "Standard"}}, + ) + print(response) + + +# x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-01-01/examples/Pricings/PutPricingByNamePartialSuccess_example.json +if __name__ == "__main__": + main()